# R version of 99 Bottles of beer (Bottles.r)
# See http://www.r-project.org/ for more informations
# Philipp Winterberg, http://www.winterbergs.de
for (b in 99:1){
print(b)
print(" bottle(s) of beer on the wall,")
print(b)
print(" bottle(s) of beer.")
print("Take one down, pass it around,")
print(b-1)
print(" bottle(s) of beer on the wall.")
print("")
}
*-----------------------------------------------------------------------
* 99 BOTTLES OF BEER ON THE WALL - RAMIS EXECUTIVE VERSION
*-----------------------------------------------------------------------
CATALOGS BEER
&&COUNT/I2 = 99;
&&LOOP
&&BOTTLES/A7 = IF &COUNT GT 1 THEN 'BOTTLES' ELSE 'BOTTLE ';
&&PRINT &COUNT &BOTTLES OF BEER ON THE WALL, &COUNT &BOTTLES OF BEER
&&PRINT TAKE ONE DOWN, PASS IT AROUND
&&COUNT/I2 = &COUNT - 1;
&&IF &COUNT GT 0 GOTO LOOP;
&&PRINT NO MORE BOTTLES OF BEER ON THE WALL, NO MORE BOTTLES OF BEER
&&PRINT GO TO THE STORE AND BUY SOME MORE
END CATALOGS
EXEC BEER
*----------------------------------------------------------------------
* 99 BOTTLES OF BEER ON THE WALL - RAMIS SBX VERSION
*----------------------------------------------------------------------
PROCESS;
DECLARE COUNT AS I2;
DO FROM COUNT = 99 TO 2 BY -1;
PRINT &COUNT BOTTLES OF BEER ON THE WALL, &COUNT BOTTLES OF BEER;
PRINT TAKE ONE DOWN, PASS IT AROUND;
ENDDO;
PRINT 1 BOTTLE OF BEER ON THE WALL, 1 BOTTLE OF BEER;
PRINT TAKE ONE DOWN, PASS IT AROUND;
PRINT NO MORE BOTTLES OF BEER ON THE WALL, NO MORE BOTTLES OF BEER;
% RapidBATCH version of 99 Bottles of beer (Bottles.rb)
% http://www.jmksf.com/rbatch.html.
% Philipp Winterberg, http://www.winterbergs.de
Title 99 Bottles of Beer
Dec [b]
Let [b]=99
%next
EchoLn [b]
EchoLn bottle(s) of beer on the wall,
EchoLn [b]
EchoLn bottle(s) of beer.
EchoLn Take one down, pass it around,
CalcVar [b]=[b]-'1'
EchoLn [b]
EchoLn bottle(s) of beer on the wall.
If Not [b]='0' GoTo next
Wait
End
# RBASIC version of 99 Bottles of beer (Bottles.rbp)
# See http://www.rbasic.com/
# Philipp Winterberg, http://www.winterbergs.de
a$=" bottle(s) of beer":c$=" on the wall":d$=chr$(13)+chr$(10)
for b = 99 to 1 step -1
disp str$(b)+a$+c$+","+d$+str$(b)+a$+"."
print "Take one down, pass it around, "
print str$(b-1)+a$+c$+"."+d$+d$
next b
rpower=0:end
// "99 Bottles of Beer on the Wall" for RealBasic (http://www.realsoftware.com/)
// Written by Uriah Carpenter
// To run add the below code to the "Open" event of a listbox
dim bottles as integer
dim plural as string
bottles = 99
plural = "s"
do
me.addRow(str(bottles) + " bottle" + plural + " of beer on the wall, " +
str(bottles) + " bottle" + plural + " of beer.")
bottles = bottles - 1
if bottles = 1 then
plural = ""
else
plural = "s"
end if
me.addRow("Take one down, pass it around, " + str(bottles) + " bottle" +
plural + " of beer on the wall.")
loop until bottles = 0
; REBOL/Core version of 99 Bottles of beer (Bottles.r)
; See http://www.rebol.com/docs/core23/rebolcore.html
; Philipp Winterberg, http://www.winterbergs.de
REBOL [Title: "99 Bottles of beer"]
for b 99 1 -1 [
prin b print " bottle(s) of beer on the wall,"
prin b print " bottle(s) of beer."
print "Take one down, pass it around,"
prin b - 1 print " bottle(s) of beer on the wall."
print ""
]
REBOL [
Title: "99 Bottles of Beer Song"
Date: 26-Apr-1998
File: %beersong.r
Home: http://www.reboltech.com/library/script-script.html
Purpose: "The correct song. A bit more advanced."
Category: [misc script 3]
Note: {
REBOL is pronounced like "rebel", and stands for
Relative Expression-Based Object Language
}
]
sing: func [count rest] [
prin pick ["99 bottles " "no bottles " "1 bottle " [count "bottles "]]
min 4 count + 2
print rest
]
for bottles 99 0 -1 [
sing bottles "of beer on the wall,"
sing bottles "of beer."
print pick [
"Take one down, pass it around,"
"Go to the store, buy some more,"
] bottles > 0
sing bottles - 1 "of beer on the wall."
print ""
]
/* Rexx Version of the Bottles program */
/* by Lee Stewart (ls@sweng.stortek.com) */
Trace Off;
Do Forever;
Do i = 99 To 1 By -1;
If i > 1 Then pl = 's';
Else pl = '';
Say i 'bottle'pl 'of beer on the wall,' i 'bottle'pl 'of beer';
Say 'Take one down, pass it around';
End;
Say 'No more bottles of beer on the wall, no more bottles of beer';
Say 'Go to the store and buy some more';
End;
package wiki.beer;
import robocode.*;
import java.awt.geom.Point2D;
// BeerPoet, one way to go about writing the 99-bottles-of-beer poem.
// By Peter Strömberg, http://robowiki.dyndns.org/?PEZ
// For more info on the poem: http://99-bottles-of-beer.ls-la.net/
//
// Run this robot in Robocode.
// Put it against 99 SittingDuck and open its output window.
public class BeerPoet extends AdvancedRobot {
private boolean hasStarted;
public void run() {
turnGunRightRadians(Double.POSITIVE_INFINITY);
}
public void onScannedRobot(ScannedRobotEvent e) {
if (!hasStarted) {
printBottles();
hasStarted = true;
}
setFire(3);
setTurnGunRightRadians(0 - getGunTurnRemainingRadians());
}
public void onRobotDeath(RobotDeathEvent e) {
printBottles();
}
private void printBottles() {
out.println(bottles());
if (getOthers() > 0) {
out.println("Take " + (getOthers() == 1 ? "it" : "one") +
" down, and pass it around");
}
else {
out.println("Now they are all gone");
}
}
private String bottles() {
return bottles(getOthers()) + " on the wall, " + bottles(getOthers());
}
private String bottles(int bottles) {
return (bottles == 0 ? "No" : "" + bottles) +
" bottle" + (bottles == 1 ? "" : "s") + " of beer";
}
}
# RSL version of 99 Bottles of Beer
# See http://www.robotbattle.com/
# By Ville Saalo, http://koti.mbnet.fi/villes/
Init
{
Name( "99 Bottles of Beer" )
Version( "1.6" )
Author( "Ville Saalo" )
Style( "Omicron" )
print("New game!")
print("")
LockAll(1)
RegCore( SingingAndFighting )
if( _gamenbr > 10 )
RegDtcWall( MeSeeWallMeGoNuts, 1 )
endif
if( bottles <= 0 )
bottles = 99
endif
}
SingingAndFighting
{
if( bottles <= 0 )
print("*Bottle delivery!*")
bottles = 99
endif
GoSub( GetPlural )
print(bottles+" bottle"+plural+" of beer on the wall")
print(bottles+" bottle"+plural+" of beer")
print("Take one down, pass it around")
bottles = bottles-1
GoSub( GetPlural )
if( bottles > 0 )
print(bottles+" bottle"+plural+" of beer on the wall")
print("")
else
print("No more bottles of beer on the wall")
msgbox("Go to the store, buy some more?")
if( _result^2 == 1 )
#-1 means the msgbox was redirected to print and 1 means "OK".
#couldn't use abs() because it would have used _result and
#I didn't want a new variable for it, so x^2==1 if abs(x)==1.
print("---")
bottles = 99
else
Suicide()
endif
endif
GunLeft( (_dtcrobot==0)*5 )
Scan()
Fire( _dtcrobot*7 )
}
MeSeeWallMeGoNuts
{
GetRandom(42)
if( _result == 42 )
print("")
print(bottles+" bottles of beer on the wall")
print(bottles+" bottles of beer")
print("Shoot the wall down, drive over the debris")
bottles = 0
print("No more bottles of beer on the wall!")
print("(I got bored...)")
print("")
endif
}
GetPlural
{
if( bottles != 1 )
plural = "s"
else
plural = ""
endif
}
Dead
{
print("Oh, the game ended. There were "+bottles+" bottles of beer on the wall left")
Store(bottles) #store the number for next match
}
H*
H* RPG/400 VERSION OF THE BOTTLES PROGRAM *
H*
FSCREEN O F 80 WORKSTN
C MOVE 100 X 30
C X DOWGE0
C EXCPT
C SUB 1 X
C END
C SETON LR
OSCREEN E
O X 3
O 26 'BOTTLES OF BEER ON THE'
O 31 'WALL,'
O X 36
O 53 'BOTTLES OF BEER'
O E
O 22 'TAKE ONE DOWN AND PASS'
O 32 'IT AROUND'
#99 Bottles of beer, in Ruby
#by Mike Gertz, Jan 5, 2003
#See www.rubycentral.com for info on the language.
class OneBottle
def sing
puts "One bottle of beer on the wall."
puts "One bottle of beer."
puts "Take it down, pass it around."
puts "No more bottles of appear on the wall!"
end
end
class TwoBottles
def sing
puts "Two bottles of beer on the wall."
puts "Two bottles of beer."
puts "Take one down, pass it around."
puts "One bottle appears on the wall."
puts
end
end
class Bottles
attr_reader :number
def Bottles.verse( number )
if number > 2
Bottles.new( number )
elsif number == 2
TwoBottles.new
else
OneBottle.new
end
end
def initialize( number )
@number = number
end
def sing
puts "#{number} bottles of beer on the wall."
puts "#{number} bottles of beer."
puts "Take one down, pass it around,"
puts "#{number - 1} bottles appear on the wall!"
puts
end
end
99.downto(1) do | i |
Bottles.verse(i).sing
end
-- Runtime Revolution, a cross-platform environment for development and
-- distribution
-- Jeanne deVoto and David Vaughan, 29 July 2002
global gDrinking
constant bottlePhrase = "more bottles of beer on the wall"
constant drinkPhrase = "Take one down and pass it around"
constant oneLeftPhrase = "One last bottle of beer on the wall"
constant singAlong = 2
constant startBottles = 99
local bottles
on openCard
put startBottles into bottles
DrinkThem
end openCard
on DrinkThem
switch bottles
case 0
put startBottles into bottles
put "No" && bottlephrase & ", no" && toLower(bottlephrase) &
return & \
"Go to the store and buy some more," && bottles &&
toLower(bottlephrase)
break
case 1
put oneLeftPhrase & comma && toLower(oneLeftPhrase) & return \
& drinkPhrase & comma && bottles - 1 && toLower(bottlephrase)
break
default
put bottles && bottlePhrase & comma && bottles &&
toLower(bottlePhrase) \
& return & drinkPhrase & comma && bottles - 1 &&
toLower(bottlephrase)
end switch
subtract 1 from bottles
send DrinkThem to me in singAlong seconds
put the result into gDrinking
end DrinkThem
// Ruri version of 99 Bottles of beer.
// By Tom Rothamel <tom-ijvm@onegeek.org>
//
// See http://onegeek.org/~tom/software/ruri/ for more info on the
// language.
main {
word i;
for (i = 99; i > 0; i) {
printbottlesob(i);
out " on the wall,\n";
printbottlesob(i);
out ".\n";
i = i - 1;
out "Take one down, pass it around,\n";
printbottlesob(i);
out " on the wall.\n\n";
}
halt;
}
method printbottlesob(word n) {
word q;
word oldn;
oldn = n;
if (n > 0) {
q = 0;
while (n >= 10) {
n = n - 10;
q = q + 1;
}
if (q) out '0' + q;
out '0' + n;
} else {
out "No";
}
out " bottle";
if (oldn != 1) out "s";
out " of beer";
return 0;
}
This version of 99 bottles is written in RXML, a markup language used
by the Roxen webserver, found at www.roxen.com.
<comment>
99 bottles of beer on the wall in RXML
Written by Tomas Berndtsson <tomas@nocrew.org>
Tested in Roxen WebServer 2.1.
</comment>
<set variable="var.pl" value="s"/>
<for variable="var.i" from="99" to="1">
&var.i; bottle&var.pl; of beer on the wall,<br>
&var.i; bottle&var.pl; of beer.<br>
Take one down and pass it around,<br>
<set variable="var.j" expr="&var.i; - 1"/>
<if variable="var.j = 1"><set variable="var.pl" value=""/></if>
<else><set variable="var.pl" value="s"/></else>
<if variable="var.j = 0">No more</if>
<else>&var.j;</else>
bottle&var.pl; of beer on the wall.<p>
</for>
Greetings,
Tomas