' VBA/Access version of 99 Bottles of beer (Bottles.mdb)
' Philipp Winterberg, http://www.winterbergs.de
'
' How to use:
' 1. Create a new database (Bottles.mdb)
' 2. Create a new module
' 3. Paste this code snippet
' 4. Click "Play"-button and enjoy ;)
'
Public Function Bottles()
On Error GoTo Bottles_Err
Dim b As Integer
For b = 99 To 1 Step -1
If MsgBox(b & " bottle(s) of beer on the wall, " & vbCr & b & " bottle(s) of beer." & vbCr & _
"Take one down, pass it around, " & vbCr & (b - 1) & " bottle(s) of beer on the wall.", _
65, "99 Bottles of Beer") = 2 Then
Exit Function
End If
Next
Bottles_Exit:
Exit Function
Bottles_Err:
MsgBox Error$
Resume Bottles_Exit
End Function
' *short* VBScript/WSH version of 99 Bottles of beer (Bottles.vbs)
' Philipp Winterberg, http://www.winterbergs.de
'
For b = 99 To 1 Step -1
WScript.Echo b & " bottle(s) of beer on the wall, " & b & " bottle(s) of beer."
WScript.Echo "Take one down, pass it around, " & (b-1) & " bottle(s) of beer on the wall."
Next
{ 99 Bottles of Beer in VectorScript }
{ VectorScript is the scripting language of the VectorWorks CAD package }
{ Programming by Paul C. Zimmerman (paul at lugal dot com) }
PROCEDURE beer;
VAR
i: INTEGER;
BEGIN
FOR i:=99 DOWNTO 2 DO
BEGIN
Message(i,' bottles of beer on the wall...');
Message(i,' bottles of beer!');
Message('You take one down, pass it around...');
IF (i>2) THEN Message(i-1,' bottles of beer on the wall.')
ELSE Message('1 bottle of beer on the wall.')
END;
Message('1 bottle of beer on the wall...');
Message('1 bottle of beer!');
Message('You take one down, pass it around...');
Message('No more bottles of beer on the wall.');
END;
RUN(beer);
/***********************************************************
* Module: 99 bottles of beer
* By Danny Mulligan
***********************************************************/
module beer;
integer i;
initial begin
for (i=99; i>0; i=i-1)
begin
$display("%0d bottles of beer on the wall,", i);
$display("%0d bottles of beer,", i);
$display("Take one down and pass it around,");
if (i==1)
$display("No more bottles of beer on the wall.\n");
else
$display("%0d bottles of beer on the wall.\n", i-1);
end
$display("Go to the store and buy some more.");
end
end
-- This is the VHDL (ANSI/IEEE Std 1076 - 1993)
-- version of the beer song.
-- F. J. Ludicky, Sundstrand Aerospace
entity beer_song is
port(bottles: out integer;
words: out string(1 to 28);
start_singing: in boolean);
end beer_song;
architecture silly of beer_song is
begin
lets_sing: process
begin
wait on start_singing until start singing;
for index_bottles in 99 downto 1 loop
bottles <= index_bottles;
words <= "bottles of beer on the wall,";
wait for 5 sec;
bottles <= index_bottles;
words <= "bottles of beer, ";
wait for 5 sec;
words <= "take one down, ";
wait for 5 sec;
words <= "pass it around, ";
wait for 5 sec;
bottles <= index_bottles - 1;
words <= "bottles of beer on the wall."
wait for 5 sec.
end loop;
assert false report "No more beer!" severity warning;
end process lets_sing;
end silly;
I
! 99 bottles of beer lyrics generation using vi macros!
!
! instructions:
! 1. rename your .exrc (so you have no existing macros to conflict with mine)
! 2. vi outfile < this_file >/dev/null 2>&1
! the output will be in outfile
!
! Please note that this file is littered with control characters.
! All ^V, and ^] and ^M character sequences are control characters.
! The other occurrences of ^ are actually supposed to be there.
!
! I also might be the first to point out that I took the liberty of
! using 'bc' to do my recalculations (sorry).
!
! Scott Engberg
! 6/8/96
! Scott.Engberg@mfa.com
!
^[Gd1G
:set magic
:map F A bottles of beer on the wall^V^M
:map K A bottles of beer^V^M
:map H Atake one down pass it around^V^M
:map Q "aP
:map O "ayy
:map W A-1
:map E !!bc^V^M
:map S :s/^\([1-9]\)/\1/^V^M
:map R OF^V^[QK^V^[H^V^[QW^V^[EST
:map T R
i99^[R^[
G
?^0
dG
oNo more bottles of beer on the wall!^[
:wq!
//99 bottles of beer in VIB Skript
//By Mark Kingery
:Bottles
Start
:Start
init
count_down
:init
FCT CALC @bottles = 99 //initialize Variable
:count_down
LAB down
FCT INSTR @Bottles "bottles of beer on the wall"
FCT INSTR @Bottles "bottles of beer"
FCT INSTR "take one down pass ist around" E
FCT CALC @Bottles = @Bottles -1
RES PASSED " " ->down
// 99 Bottles of Beer in VICC = VICC's Intended for Compiler Courses
// (C) 1996 Juha Autero
DEFINE nl(tabify : Int) : Int
IF tabify != 0 THEN
WriteString("\n\t");
ELSE
WriteString("\n");
END;
RETURN 0;
END;
DEFINE beer(b : Int) : Int
WriteInt(b);
WriteString(" bottles of beer");
RETURN 0;
END;
DEFINE Main() : Int
DEFINE i : Int;
i := 99;
WHILE i >= 1 DO
nl(1);
beer(i);
WriteString(" on the wall,");
nl(1);
beer(i);
WriteString(".");
nl(1);
WriteString("Take one down, pass it around");
nl(1);
beer(i - 1);
WriteString(" on the wall.");
nl(0);
i := i - 1;
DONE;
END;
" Vim version. Vim is a mighty vi clone. http://www.vim.org.
" Yank, execute, and call w/:
" :%y | @" | call BeerSong()
fun! BeerSong()
let n = 100
while n > 0
let b = Bottles(n)
echo b 'on the wall,' b.','
let n = n - 1
let b = Bottles(n)
echo ' take one down, pass it around,' b 'on the wall.'
endw
endf
fun! Bottles(n)
let p = (a:n > 0) ? a:n : 'no more'
let s = (a:n == 1) ? '' : 's'
return p.' bottle'.s.' of beer'
endf
Step 1: Create a New Console Application and then, add the following code in
the principal Module:
Module Bottles
Sub Main()
' Visual Basic.NET version of 99 Bottles of beer (Bottles.vb)
' Fabrício Costa, fabricio_costa@msn.com
Dim Count As Int32
For Count = 99 To 1 Step -1
Console.WriteLine(Count & " bottle(s) of beer on the wall, " & Count & " bottle(s) of beer.")
Console.WriteLine("Take one down, pass it around, " & (Count - 1) & " bottle(s) of beer on the wall.")
Next
End Sub
End Module
rem Visual DialogScript version of 99 Bottles of beer (Bottles.dsc)
rem See http://www.dialogscript.com/en/
rem Made VDS 2.x Compatible by Brandon Cunningham cnodnarb@aol.com
DIALOG CREATE,Bottles of Beer,-1,0,240,160,-
TEXT(B;10;10;;;Text)
%A = " bottle(s) of beer"
%B = 99
%C = " on the wall"
%D = "Take one down, pass it around,"
repeat
DIALOG SET,B,%B%A%C","@CR()%B%A.@CR()%D@CR()@PRED(%B)%A%C.@CR()@CR()
%B = @PRED(%B)
WAIT 2
until @not(@GREATER(%B, 0))
DIALOG CLOSE
EXIT
rem Visual DialogScript 3.x version of 99 Bottles of beer (Bottles.dsc)
rem See http://www.dialogscript.com/en/
rem by Brandon Cunningham cnodnarb@aol.com
rem Original by Philipp Winterberg, http://www.winterbergs.de
DIALOG CREATE,99 Bottles of Beer,-1,0,600,400
DIALOG ADD,TEXT,B,23,23,400,200
DIALOG SHOW
%A = " bottle(s) of beer"
%B = 99
%C = " on the wall"
%D = "Take one down, pass it around,"
repeat
DIALOG SET,B,%B%A%C","@CR()%B%A.@CR()%D@CR()@PRED(%B)%A%C.@CR()@CR()
%B = @PRED(%B)
WAIT 2
until @not(@GREATER(%B, 0))
DIALOG CLOSE
EXIT
rem Visual DialogScript version of 99 Bottles of beer (Bottles.dsc)
rem See http://www.dialogscript.com/en/
rem Philipp Winterberg, http://www.winterbergs.de
DIALOG CREATE,99 Bottles of Beer,-1,0,600,400
DIALOG ADD,TEXT,B,23,23,400,200
DIALOG SHOW
%A = " bottle(s) of beer"
%B = 99
%C = " on the wall"
%D = "Take one down, pass it around,"
WHILE @GREATER(%B, 0)
DIALOG SET,B,%B%A%C","@CR()%B%A.@CR()%D@CR()@PRED(%B)%A%C.@CR()@CR()
%B = @PRED(%B)
WAIT 2
WEND
DIALOG CLOSE
EXIT
********************************************
* TAKE1DN.PRG (For Visual Foxpro) *
* 99 Bottles: A simulation *
* Richard Katz *
* richkatz@earthlink.net *
********************************************
wall=createobject("dispcontainer")
wall.name="wall"
clear
**************************************
* First put the beer on the wall.
for i=1 to 99
oname="b"+ltri(str(i))
wall.addobject(oname,"bottle")
endfor
**************************************
* So we can get what's in the bottles...
obcont=wall.objects(1).content
***************************************
* And away we go.
do while wall.controlcount>0
? wall.dispself(), "of",obcont,"on the",lower(wall.name)+","
? wall.dispself(), "of", obcont
wall.removeobject(wall.objects(wall.controlcount).name)
? wall.dispself(), "of", obcont
if wall.controlcount>0
?? ", Oh..."
endif
enddo
define class dispcontainer as container
proc dispself
return ltri(str(this.controlcount))+" "+this.dispobj()
proc dispobj
if this.controlcount>0
obout=lower(this.objects(1).class)
else
obout="nothing"
endif
if this.controlcount<>1
obout=obout+"s"
endif
return obout
enddefine
define class bottle as custom
content="beer"
proc destroy
? "take one down, pass it around."
endproc
enddefine
code:
// Visual MB - http://www.visual-mb.de
// 99 Bottles - by Michael Böhme
//99 Bottles of Beer
[Main].Hide
$Define [Bottles] = "100"
ConsoleCreate
%again%
[Bottles]--
If [Bottles] > "1" then
ConsoleWrite [Bottles] + " bottles of beer on the wall, "
ConsoleWriteln [Bottles] + " bottles of beer."
ConsoleWriteln "Take one down, pass it around, "
Goto %again%
IfEnd
ConsoleWriteln "1 bottle of beer on the wall, 1 bottle of beer."
ConsoleWriteln "Take one down, pass it around, no more bottles of beer on the wall!"
'Jeff Shepherd 9/12/96 <jeff@trg.saic.com>
'99 Bottles of Beer for Visual Basic
'(1) Start a new project, paste a single listbox on the form.
'(2) Double-click on the form, paste the following code into
'the Form_Load sub. (3) Hit F5 to run
Dim n As Integer
Dim s As String
Width = 6000
Height = Screen.Height * 2 / 3
Top = (Screen.Height - Height) / 2
Left = (Screen.Width - Width) / 2
Caption = "99 Bottles of Beer"
List1.Top = 0
List1.Left = 0
List1.Width = Form1.ScaleWidth
List1.Height = Form1.ScaleHeight
List1.AddItem s & "99 bottles of Beer on the wall,"
List1.AddItem s & "99 bottles of Beeeer..."
List1.AddItem "You take one down, pass it around..."
For n = 98 To 1 Step -1
s = IIf(n = 1, n & " final bottle", n & " bottles")
List1.AddItem s & " of Beer on the wall."
List1.AddItem ""
List1.AddItem s & " of Beer on the wall,"
List1.AddItem s & " of Beeeer..."
List1.AddItem "You take one down, pass it around..."
Next n
List1.AddItem "No more bottles of Beer on the wall."
; VP is the high-level portable assembly language used by
; Tao's intent operating system.
; David Given, http://www.cowlark.com
.include "tao"
tool "app/stdio/bottles", VP, F_MAIN, 4096, 0
ent (- : -)
regdef int number
cpy.i 99, number
while (number > 0)
gos bottle, (number : -)
printf " of beer on the wall,\n"
gos bottle, (number : -)
printf " of beer.\n"
printf "Take one down and pass it around,\n"
dec.i number
gos bottle, (number : -)
printf " of beer on the wall.\n\n"
endwhile
ret ()
entend
bottle:
ent (int number : -)
if (number == 0)
printf "No bottles"
elseif (number == 1)
printf "One bottle"
else
printf "%d bottles", number
endif
ret ()
entend
toolend
// BEER.VSC - Beer 1.0
// Developed under Visual IRC '96 1.00rc5a
Name Beer 1.0
// Aliases
Alias BEER
@l $Bottle=99
while ( $Bottle > 1 )
TextOut clBlue $Bottle Bottles of beer on the wall,
TextOut clBlue $Bottle Bottles of beer.
$Bottle--
TextOut clBlue Take one down, pass it around,
TextOut clBlue $Bottle Bottles of beer on the wall.
TextOut clBlue
endwhile
TextOut clRed 1 Bottle of Beer on the wall,
TextOut clRed 1 Bottle of Beer.
TextOut clRed Take One Down, Pass it around,
TextOut clRed No more bottles of Beer on the wall.
-@ $Bottle
EndAlias
The following is a VoiceXML implementation of the 99 Bottles of Beer song.
It can be executed at http://studio.tellme.com/
Author: Björn Andersson <vxml-guru@rymden.nu>
<vxml version="2.0">
<form>
<var name="bottles" expr="99"/>
<block name="verse">
<if cond="bottles == 1">
1 bottle of beer on the wall,
1 bottle of beer.
<else/>
<value expr="bottles"/> bottles of beer on the wall,
<value expr="bottles"/> bottles of beer.
</if>
Take one down, pass it around.
<assign name="bottles" expr="bottles-1"/>
<if cond="bottles == 0">
No more bottles of beer on the wall.
<disconnect/>
<elseif cond="bottles == 1"/>
1 bottle of beer on the wall,
<else/>
<value expr="bottles"/> bottles of beer on the wall,
</if>
<goto nextitem="verse"/>
</block>
</form>
</vxml>