/// b5 version of 99 bottles of beer
/// Laurent Vogel, http://lvogel.free.fr
/// b5 url: http://sange.fi/~atehwa/b5/
/// run as: echo | b5 THIS_FILE
mac nl i => i<<<
>>>;;;
mac t i => <<<Take one down, pass it around>>>nl(i);;;
mac p n s c => n<<< bottle>>>s<<< of beer>>>nl(c);;;
mac w i => <<< on the wall>>>i;;;
mac a n => p(n)(s)(w(.))nl()p(n)(s)(w(,))p(n)(s)(.)t(,);;;
mac b n m => a(n<<<>>>m);;;
mac c n => b(n)(8)b(n)(7)b(n)(6)b(n)(5)b(n)(4)b(n)(3)b(n)(2);;;
mac d n => b(n)(9)c(n)b(n)(1)b(n)(0);;;
data
p(99)(s)(w(,))p(99)(s)(.)t(,)c(9)b(9)(1)b(9)(0)d(8)d(7)d(6)d(5)d(4)d(3)
d(2)d(1)c()p(1)()(w(,))nl()p(1)()(w(,))p(1)()(.)t(,)p(No
more)(s)(w(.));;;
|********************************************************
|* Run this from the Baan shell
|* By Stark Springs, 18th June 2002
|********************************************************
function main()
{
long wnd,i
wnd=new.window(22, 80, 1, 1)
scroll(wnd)
for i=99 to 1 step -1
print i, " bottle(s) of beer on the wall,", cr$(), lf$()
print i, " bottle(s) of beer.", cr$(), lf$()
print i-1, " bottle(s) of beer on the wall.", cr$(), lf$(2)
refresh(wnd)
endfor
message("")
}
This is an emulation of Babbage's original design.
Details and the emulator may be found at
<a href=http://www.fourmilab.ch/babbage/>http://www.fourmilab.ch/babbage/</a>
. 99 bottles of beer song
. written for Babbage's Analytical Engine with Attendant
. by Greg Cook 15/1/1998
. Attendant converts flow structure to conditional jumps
. No new line after number
A write in columns
. constants
N000 0
N001 1
N002 2
. bottle count
N003 99
(?
-
L003
P
. finish subtraction to compare bottles to 1
L002
{?
A write annotation bottles
}{
A write annotation bottle
}
A write annotation of beer on the wall,
A write new line
. new subtraction card to clear mill
-
L003
P
L002
{?
A write annotation bottles
}{
A write annotation bottle
}
A write annotation of beer,
A write new line
A write annotation Take one down and pass it around,
A write new line
. Still subtracting, update counter
L003
L001
S003
. compare for 0 this time
L003
L001
{?
. if <=0 then don't finish verse
-
L003
P
L002
{?
A write annotation bottles
}{
A write annotation bottle
}
A write annotation of beer on the wall.
A write new line
A write new line
}
. if >0 then continue loop
L000
L003
)
A write annotation No more bottles of beer on the wall!
A write new line
10 REM Basic version of 99 bottles of beer
20 FOR X=100 TO 1 STEP -1
30 PRINT X;"Bottle(s) of beer on the wall,";X;"bottle(s) of beer"
40 PRINT "Take one down and pass it around,"
50 PRINT X-1;"bottle(s) of beer on the wall"
60 NEXT
rem BasicBasic version of 99 Bottles of beer (Bottles.bas)
rem See http://www.programmersheaven.com/search/Download.asp?FileID=16394
rem Philipp Winterberg, http://www.winterbergs.de
a$=" bottle(s) of beer" : c$=" on the wall"
for b = 99 to 1 step -1
print b; a$; c$; ","
print b; a$; "."
print "Take one down, pass it around,"
print b-1; a$; c$; "."
print
next b
if ostype = 1 then
do while inkey$=""
loop
end if
end
REM BBC BASIC version of 99 Bottles of beer (Bottles.bbc)
REM See: http://www.bbcbasic.com/
REM Philipp Winterberg, http://www.winterbergs.de
FOR b=99 TO 1 STEP -1
PRINT 'b;, " bottle(s) of beer on the wall,"
PRINT b;,, " bottle(s) of beer."
PRINT ,,,, "Take one down, pass it around,"
PRINT b-1; " bottle(s) of beer on the wall."
NEXT b
/* 99 bottles of beer in Unix bc */
/* by Adam Roach <adam.roach@exu.ericsson.se> */
/* */
/* In theory, this could be shortened by functions, but the version of */
/* bc that I have access to doesn't allow functions... so this is long... */
i = 99
while ( i > 0 ) {
if (i/10 == 1) "1"
if (i/10 == 2) "2"
if (i/10 == 3) "3"
if (i/10 == 4) "4"
if (i/10 == 5) "5"
if (i/10 == 6) "6"
if (i/10 == 7) "7"
if (i/10 == 8) "8"
if (i/10 == 9) "9"
if (i%10 == 0) "0 bottle"
if (i%10 == 1) "1 bottle"
if (i%10 == 2) "2 bottle"
if (i%10 == 3) "3 bottle"
if (i%10 == 4) "4 bottle"
if (i%10 == 5) "5 bottle"
if (i%10 == 6) "6 bottle"
if (i%10 == 7) "7 bottle"
if (i%10 == 8) "8 bottle"
if (i%10 == 9) "9 bottle"
if (i != 1) "s"
" of beer on the wall,
"
if (i/10 == 1) "1"
if (i/10 == 2) "2"
if (i/10 == 3) "3"
if (i/10 == 4) "4"
if (i/10 == 5) "5"
if (i/10 == 6) "6"
if (i/10 == 7) "7"
if (i/10 == 8) "8"
if (i/10 == 9) "9"
if (i%10 == 0) "0 bottle"
if (i%10 == 1) "1 bottle"
if (i%10 == 2) "2 bottle"
if (i%10 == 3) "3 bottle"
if (i%10 == 4) "4 bottle"
if (i%10 == 5) "5 bottle"
if (i%10 == 6) "6 bottle"
if (i%10 == 7) "7 bottle"
if (i%10 == 8) "8 bottle"
if (i%10 == 9) "9 bottle"
if (i != 1) "s"
" of beer.
"
i = i - 1
"Take one down, pass it around.
"
if (i/10 == 1) "1"
if (i/10 == 2) "2"
if (i/10 == 3) "3"
if (i/10 == 4) "4"
if (i/10 == 5) "5"
if (i/10 == 6) "6"
if (i/10 == 7) "7"
if (i/10 == 8) "8"
if (i/10 == 9) "9"
if (i%10 == 0) "0 bottle"
if (i%10 == 1) "1 bottle"
if (i%10 == 2) "2 bottle"
if (i%10 == 3) "3 bottle"
if (i%10 == 4) "4 bottle"
if (i%10 == 5) "5 bottle"
if (i%10 == 6) "6 bottle"
if (i%10 == 7) "7 bottle"
if (i%10 == 8) "8 bottle"
if (i%10 == 9) "9 bottle"
if (i != 1) "s"
" of beer on the wall.
"
}
quit
// BCPL version of 99 Bottles of Beer.
// hacked by Akira KIDA <SDI00379@niftyserve.or.jp>
GET "LIBHDR"
MANIFEST $(
BOTTLES = 99
$)
LET START() BE $(
LET BEERS(N, S) BE $(
TEST N = 0 THEN WRITEF("No more bottles")
ELSE WRITEF("%N bottle%S", N, (N = 1) -> "", "s")
WRITEF(" of beer%S", S)
$)
FOR I = BOTTLES TO 1 BY -1 DO $(
BEERS(I, " on the wall, ")
BEERS(I, ".*NTake one down, pass it around.*N")
BEERS(I - 1, " on the wall.*N")
$)
FINISH
$)
This was created partially to frustrate a programming instructor (not
that that isn't a worthy goal) and 99BoB was used to test the
language constructs. It's a combination of Befunge and a desk
calculator. Details at
<a href=http://www.cs.su.oz.au/~sholden/BefDC>http://www.cs.su.oz.au/~sholden/BefDC
>9999*++000s1100sXv< >#v100g5-v
X >100g3- |v _@
|-2g001_ v
v *39s1010pg000 s0012-#< <
vv*35s1010pg000< 1
v## *47s1011s0014g# <
v*35s1010<Xs000-1g000s0011<
X>3100sv 0
^ < 1
^
{
000 > x
v s100+1g100 <
>001g101g9gp001g201g -|
s 0
1 0
0 0
2 xv# < 1
^ >000v s
v0pg< P
0 x
g
^_5100s^
{
100 bottles of beer.
{
In BefDC - a derivative of Befudge and dc, by Sam Holden
{
This code by Sam Holden, 1997.
{
Note: this language was actually designed to do my cryptography assigments,
which is why it is defined with 'infinite' precision math.
{
{
{
{
bottles of beer on the wall
Take one down, pass it around
ORIGIN '~beta/basiclib/v1.4/betaenv';
--- program: descriptor ---
(* 99 bottles in BETA. Ole Villumsen, October 27, 1995. *)
(# putBottles: (# no: @integer;
enter no
do (if no//1 then '1 bottle' -> putLine;
else no -> putInt; ' bottles' -> putText;
if);
#);
do (for i:99 repeat
100-i -> putBottles; ' of beer on the wall,' -> putLine;
100-i -> putBottles; ' of beer.' -> putLine;
'Take one down, pass it around,' -> putLine;
99-1 -> putBottles; ' of beer on the wall.' -> putLine; newLine;
for)
#)
'bind' is the internet domain name server from ISC (www.isc.org/bind)
and is by far the most ubiquitous nameserver out there and a rather
important part of the fabric of the internet. You need bind version 8 or
9 for this to work.
Anyway, here goes:
zone-file (e.g. bottles-of-beer.example.com)
--------------------------------------------
$TTL 86400
$ORIGIN bottles-of-beer.example.com.
IN NS ns.example.com.
IN SOA ns.example.com. postmaster.example.com. (
1 ; Serial
28800 ; Refresh
7200 ; Retry
604800; Expire
600 ) ; Minimum
$GENERATE 2-99 $ CNAME ${-1}
1 IN CNAME no
no IN A 127.0.0.1
---------------------------------------------
The $GENERATE statement represents a list of entries in the zone file.
The fact that it supports some arithmatic allows us to generate this:
99.bottles-of-beer.example.com IN CNAME 98.bottles-of-beer.example.com
98.bottles-of-beer.example.com IN CNAME 97.bottles-of-beer.example.com
...
1.bottles-of-beer.example.com IN CNAME no.bottles-of-beer.example.com
In DNS, a CNAME is a pointer to another entry in the DNS. And in this
hack, that entry once again points to the next entry, etc., all leading
to 'no bottles', which is the only entry with a 'real' IP-address.
To view this list, one could download the contents of the domain using
e.g. dig:
dig @ns.example.com bottles-of-beer.example.com axfr
(This would show all generated entries)
This is a custom language project. The compiler is available at
<a href=http://www.sound.net/~aturley/blank.htm>http://www.sound.net/~aturley/blank.htm</a>
99 Bottles of Beer
Written in Blank
by Andrew Turley
[99] bottles of beer
{#} pop the last calling cell
[20]{>} call "x bottles of beer on the wall,"
[65]{>} call "x bottles of beer."
[98]{>} call "Take one down, pass it around,"
{:}[1]{-}{!}[7]{\}{|} if bottles of beer is not 1
[124]{>} call "x-1 bottles of beer on the wall!"
{?}[19]{-}{>} go back to the beginning of the program
[157]{>} otherwise goto "No bottles of beer on the wall!"
"x bottles of beer on the wall," :36+11
{:}{.} print bottles of beer
[0] string termination
[10] "\n"
[44][108][108][97][119][32][101][104][116][32][110][111][32] ",llaw
eht no " [114][101][101][98][32][102][111][32] "reeb fo "
[24]{^}[1]{-}[4]{\}{!}{|} [115] "s" [1]{>}{#}
[101][108][116][116][111][98][32] "elttob " [34]{>} call the printing
part of the program {<} return to calling cell
"x bottles of beer." :24+11
{:}{.} print bottles of beer
[0] string termination
[10] "\n"
[46][114][101][101][98][32][102][111][32] ".reeb fo "
[12]{^}[1]{-}[4]{\}{!}{|}
[115] "s"
[1]{>}{#}
[101][108][116][116][111][98][32] "elttob "
[34]{>} call the printing part of the program
{<} return to calling cell
"Take one down, pass it around" :35
[0] string termination
[10] "\n"
[44][100][110][117][111][114][97][32][116][105][32] ",dnuora ti "
[115][115][97][112][32][44][110][119][111][100][32] "ssap ,nwod "
[101][110][111][32][101][107][97][84] "eno ekaT" [38]{>} goto the
printing part of the program {<} return to calling cell
"x-1 bottles of beer on the wall!" :38
[1]{-}{:}{.} (print bottles of beer)-1
[0] string termination
[10] "\n"
[10] "\n"
[33][108][108][97][119][32][101][104][116][32][110][111][32] "!llaw
eht no " [114][101][101][98][32][102][111][32] "reeb fo "
[115][101][108][116][116][111][98][32] "selttob " [38]{>} goto the
printing part of the program {<} return to calling cell
"No bottles of beer on the wall!", terminating part of program :36 [0]
string termination [10] "\n"
[33][108][108][97][119][32][101][104][116][32][110][111][32] "!llaw
eht no " [114][101][101][98][32][102][111][32] "reeb fo "
[115][101][108][116][116][111][98][32][111][78] "selttob oN" [9]{>}
goto the printing part of the program {@} exit program
printing part of the program :13
{:}[7]{\}{!}{|}{#}{,}{?}[10]{-}{>} print the top of the stack until 0
{#} ppop the call {#} ppop the if {$} pop the 0 {<} return to calling
cell
// Blaster Master Pascal version of 99 Bottles of beer (Bottles.pas)
// See http://www.programmersheaven.com/zone24/cat351/16888.htm
// Philipp Winterberg, http://www.winterbergs.de
entity x; .float b; Function Spawn (): entity; #2;
Procedure WriteLn (...); #254;
Procedure Bottles ();
Begin
local entity h; h:= Spawn (); x:= h; x.b:= 99;
While (x.b > 0) Do
Begin
WriteLn('%f bottle(s) of beer on the wall,', x.b);
WriteLn('%f bottle(s) of beer.', x.b);
WriteLn('Take one down, pass it around,');
x.b:= x.b - 1;
WriteLn('%f bottle(s) of beer on the wall.\n', x.b);
End;
End;
module NINTY_NINE_BOTTLES_CT (main=BOTTLES) =
!
! "99 Bottles of Beer on the Wall"
! using BLISS on DIGITAL's Alpha OpenVMS
! by Ron Brender, brender@zko.dec.com
!
begin
external routine
printf : novalue external_name('DECC$GXPRINTF');
!
! To "port" this program to UNIX or WNT, use
! external_name('printf') or the appropriate lower case
! compilation option instead of the above.
macro
PUT_TEXT(T) =
printf(uplit(%asciz '%s'), uplit(%asciz T))
%,
PUT_NL (dummy) =
printf(uplit(%asciz %string(%char(10))))
%;
compiletime
TEMP = 0;
! In principle, the complete text can be constructed at compile-time and
! output with a single PUT_TEXT call, however, that runs up against a
! compile-time maximum string length. This implementation constructs a
! complete stanza at compile-time.
!
macro
BOTTLE_S(COUNT) =
%if COUNT eql 1 %then 'bottle' %else 'bottles' %fi
%,
BOTTLE_COUNT(COUNT) =
%assign(TEMP, COUNT)
%if TEMP eql 0 %then 'No' %else %string(%number(TEMP)) %fi
%,
BOTTLE_STANZA(COUNT) =
PUT_TEXT(%string(
BOTTLE_COUNT(COUNT), ' ', BOTTLE_S(COUNT),
' of beer on the wall; ',
BOTTLE_COUNT(COUNT), ' ', BOTTLE_S(COUNT), ' of beer', %char(10),
'Take one down and pass it around', %char(10),
BOTTLE_COUNT(COUNT-1), ' ', BOTTLE_S(COUNT-1),
' of beer on the wall', %char(10),
%char(10)))
%,
BOTTLE_TEXT(COUNT)[] =
BOTTLE_STANZA(COUNT);
%if COUNT gtr 1 %then
BOTTLE_TEXT(COUNT - 1)
%fi
%;
global routine BOTTLES : novalue =
begin
! Title
!
PUT_NL();
PUT_TEXT(' "99 Bottles of Beer on the Wall"'); PUT_NL();
PUT_NL();
BOTTLE_TEXT(99);
end;
end
eludom
module NINTY_NINE_BOTTLES (main=BOTTLES) =
!
! "99 Bottles of Beer on the Wall"
! using BLISS on DIGITAL's Alpha OpenVMS
! by Ron Brender, brender@zko.dec.com
!
begin
forward routine
BOTTLES : novalue, ! Main routine
BOTTLE_S : novalue, ! 'bottle<s>'
BOTTLE_COUNT : novalue; ! <n> or 'no'
external routine
printf : novalue external_name('DECC$GXPRINTF');
!
! To "port" this program to UNIX or WNT, use
! external_name('printf') or the appropriate lower case
! compilation option instead of the above.
macro
PUT_TEXT(T) =
printf(uplit(%asciz '%s'), uplit(%asciz T))
%,
PUT_INT(N) =
printf(uplit(%asciz '%*d'), if N lss 10 then 1 else 2, N)
%,
PUT_NL (dummy) =
printf(uplit(%asciz %string(%char(10))))
%;
global routine BOTTLES : novalue =
begin
! Title
!
PUT_NL();
PUT_TEXT(' "99 Bottles of Beer on the Wall"'); PUT_NL();
PUT_NL();
decr I from 99 to 1 do
begin
! <n> bottle<s> of beer on the wall; <n> bottle<s> of beer
!
BOTTLE_COUNT(.I); PUT_TEXT(' '); BOTTLE_S(.I);
PUT_TEXT(' of beer on the wall; ');
BOTTLE_COUNT(.I); PUT_TEXT(' '); BOTTLE_S(.I); PUT_TEXT(' of beer');
PUT_NL();
! Take <one|it> down and pass it around
!
PUT_TEXT('Take ');
if .I eql 1 then PUT_TEXT('it') else PUT_TEXT('one');
PUT_TEXT(' down and pass it around'); PUT_NL();
! <n-1> bottle<s> of beer on the wall
!
BOTTLE_COUNT(.I-1); PUT_TEXT(' '); BOTTLE_S(.I-1);
PUT_TEXT(' of beer on the wall'); PUT_NL();
! New stanza
!
PUT_NL();
end;
end;
routine BOTTLE_S (COUNT) : novalue =
begin
PUT_TEXT('bottle');
if .COUNT neq 1 then PUT_TEXT('s');
end;
routine BOTTLE_COUNT (COUNT) : novalue =
if .COUNT eql 0 then PUT_TEXT('No') else PUT_INT(.COUNT);
end
eludom
; Alexander Nassian - http://www.aproxx.com
Global bottles=99
Global y=10
While Not (Bottles=1)
Text 20,x,Bottles + "bottles of beer on the wall " + Bottles + "bottles
of beer"
y=y+15
Text 20,x,"Take one down, pass it around"
y=y+15
Bottles=Bottles-1
Delay 10
Wend
Delay 3000
Cls
Text 20,10,"1 bottle of beer on the wall, one bottle of beer"
Text 20,25,"no more bottles of beer on the wall"
Delay 3000
End
The author (below) created the language. "Bobo" is Spanish for idiot.
## 99.bb v1.2
## Bayard W. Wenzel
# some handy macros
/nprint {"\n" add print} def
/space {"\n" print} def
/dec {dup get 1 sub def} def
/class-define {{get invoke} bind pop-dict} def
# i will use the bobo object protocol! it is cool.
/new-bar {
13 /bar-dict create-dict
/count 0 def
/lyric-type "I'm a computer, I can't decide what to say," def
/set-count {/count exch def} def
/set-lyric-type {/lyric-type exch def} def
# proper grammar counts
/bottle-thing {
/i exch rdef
i 1 eq {
i " bottle" add print
} {
i " bottles" add print
} if-else
} def
# and, the meat of it!
/beer-lyrics {
/i exch rdef
i bottle-thing " of beer on the wall," nprint
i bottle-thing " of beer!" nprint
lyric-type nprint
i 1 sub bottle-thing " of beer on the wall." nprint space
} def
/final-lyrics {
"0 bottles of beer on the wall," nprint
"0 bottles of beer." nprint
"Go into town, buy a new round," nprint
"Get some more bottles of beer on the wall!" nprint
} def
/consume {
count {
count beer-lyrics
/count dec
} {
final-lyrics
} if-else
} def
class-define
} def
/song {
/lyric-type exch rdef
/count exch rdef
/bar new-bar rdef
count /set-count bar
lyric-type /set-lyric-type bar
count 1 add {/consume bar} loop
} def
/messy "If one of those bottles should happen to fall," def
/thirsty "Take one down, pass it around," def
99 thirsty song
#!/bin/bash
# Bourne Again shell version of 99 Bottles
# Dave Plonka - plonka@carroll1.cc.edu
typeset -i n=99
typeset bottles=bottles
typeset no
while [ 0 != $[ n ] ]
do
echo "${n?} ${bottles?} of beer on the wall,"
echo "${n?} ${bottles?} of beer,"
echo "take one down, pass it around,"
n=n-1
case ${n?} in
0)
no=no
bottles=${bottles%s}s
;;
1)
bottles=${bottles%s}
;;
esac
echo "${no:-${n}} ${bottles?} of beer on the wall."
echo
done
exit
#!/bin/sh
# Bourne shell version of 99 Bottles
# Craig J Copi - copi@oddjob.uchicago.edu
#
if [ $# -eq 1 ]; then
beers=$1
else
beers=99
fi
s="s"
while [ $beers -gt 0 ]; do
echo "$beers bottle$s of beer on the wall,"
echo "$beers bottle$s of beer,"
echo "take one down, pass it around,"
beers=`expr $beers - 1`
if [ $beers -ne 0 ]; then
test $beers -eq 1 && s=""
echo "$beers bottle$s of beer on the wall."
else
echo "no bottles of beer on the wall."
fi
echo
done
echo
echo "Time to buy some more beer . . . ."
Boxer is an editor for DOS/OS2 environment. See www.boxersoftware.com/users/dhamel
* 99 bottles of beer on the wall
* In the Boxer macro language
* Load / Compile this macro
* And execute by pressing :
* CTRL-A
* ALT-Y
* 98 <enter>
* CTRL-B
*
* Written by Gavin Spearhead 1997
* wieger1@noord.bart.nl
<macro=1><name="init beer">
99<sp>bottles<sp>of<sp>beer<sp>on<sp>wall<enter>99<sp>bottles<sp>of<sp>beer
<enter>Take<sp>one<sp>down,<sp>pass<sp>it<sp>around<enter>98<sp>bottles<sp>
of<sp>beer<sp>on<sp>wall<enter>
<macro=2><name="Drink one">
<up><up><up><up><mark down><mark down><mark down><mark down><copy><down>
<enter><paste><decrement>1<enter><down><decrement>1<enter><down><down>
<decrement>1<enter><down>
<!--
BRL version of 99 bottles of beer
http://brl.codesimply.net/
Bruce Lewis doubts he could use correct grammar after 98 beers.
-->
[(let drink ((bottles 99))
(brl-when (positive? bottles)
]<p>[bottles] bottles of beer on the wall;
[bottles] bottles of beer!<br>
Take one down, pass it around;
[(- bottles 1)] bottles of beer on the wall!</p>
[ (drink (- bottles 1))))
#!/usr/bin/bs
# bs version of 99 Bottles
# Dave Plonka - plonka@carroll1.cc.edu
# Thu Aug 8 1996
fun sing(n, end) s
s = ("s", "")[ match(n, "^1$") ]
put = format(format(format("%s bottle%%s of beer%%%%s", n), s), end)
nuf
for n = 99, n, put = ""
sing(format("%-0.0f", n), " on the wall,")
sing(format("%-0.0f", n), ",")
put = "take one down, pass it around,"
--n
sing((format("%-0.0f", n), "no")[ 0 == n ], " on the wall.")
next
run
exit
10 rem Bywater Basic version of 99 Bottles of beer (Bottles.bas)
15 rem See http://www.programmersheaven.com/zone6/cat700/15918.htm
20 rem Philipp Winterberg, http://www.winterbergs.de
30
40 for b=99 to 1 step -1
50 print str$(b) + " bottle(s) of beer on the wall,"
60 print str$(b) + " bottle(s) of beer."
70 print "Take one down, pass it around,"
80 print str$(b-1) + " bottle(s) of beer on the wall." + chr$(13) + chr$(10)
90 next b
99 end