%if 0
nasm preprocessor version of 99 bottles of beer
Laurent Vogel, http://lvogel.free.fr
run as: nasm -e THIS_FILE
%endif
%define c ,
%define id(a) a
%define p(c) i id(bottle)s of id(beer)c
%assign i 99
%define s s
%rep i i
p(id() on the id(wall)c)
p(.)
take one down, pass it around,
%assign i i-1
%if i <= 1
%define s
%if i == 0
%define i No
%endif
%endif
p(id() on the wall.)
%endrep
* PGM-ID: BEER
* AUTHOR: CHRIS BEDNARA
* COMMENT: NATURAL '99 BOTTLES OF BEER ON THE WALL' CODE
*
*-------------------------------------------------------
DEFINE DATA
LOCAL
01 #BOTTLES (I2)
END-DEFINE
*
FOR #BOTTLES 99 TO 2 STEP -1
IF #BOTTLES < 98
WRITE #BOTTLES ' BOTTLES OF BEER ON THE WALL'
WRITE ' '
END-IF
*
WRITE #BOTTLES ' BOTTLES OF BEER ON THE WALL'
WRITE #BOTTLES ' BOTTLES OF BEER'
WRITE 'TAKE ONE DOWN, PASS IT AROUND'
END-FOR
*
WRITE '1 BOTTLE OF BEER ON THE WALL'
WRITE ' '
WRITE '1 BOTTLE OF BEER ON THE WALL'
WRITE '1 BOTTLE OF BEER'
WRITE 'TAKE IT DOWN, PASS IT AROUND'
WRITE 'NO MORE BOTTLES OF BEER ON THE WALL'
WRITE ' '
WRITE 'NO MORE BOTTLES OF BEER ON THE WALL'
WRITE 'NO MORE BOTTLES OF BEER'
WRITE 'GO TO THE STORE AND BUY SOME MORE'
WRITE '99 BOTTLES OF BEER'
END
WRITE 'TAKE ONE DOWN, PASS IT AROUND'
# Bottles of beer in Navel
Greg Michaelson
greg@cee.hw.ac.uk #
def itos n = if n=0 then "0" else itos1 "" n;
def itos1 l n = if n=0 then l else itos1 (char (n%10+'0')):l n/10;
def verse n = {(itos n) " bottle(s) of beer on the wall\n"
(itos n) " bottle(s) of beer on the wall\n"
"Take one down and pass it around\n"
(itos n-1) " bottle(s) of beer on the wall\n"};
def verses n =
if n=0
then ()
else
let v = write (?(verse n))
in verses n-1;
. NeoBook version of 99 Bottles of beer (Bottles.neo)
. See http://christian.chauvin.free.fr/neobook.htm
. Philipp Winterberg, http://www.winterbergs.de
.
. How to use:
. 1. Create a new presentation
. 2. Import this code snippet as Action
. 3. Run and enjoy :-)
SetVar "[b]" "99"
SetVar "[a]" " bottle(s) of beer"
SetVar "[c]" " on the wall"
SetVar "[d]" "|Take one down, pass it around,|"
While "[b]" ">" "0"
Math "[b]-1" "0" "[e]"
StickyNote "-1" "-1" "[b][a][c],|[b][a].[d][e][a][c]." "3000"
Math "[b]-1" "0" "[b]"
EndWhile
Exit "" ""
/**
* NetRexx is a java front-end. You type rexx, it compiles to java.
* For more info, look at: http://www2.hursley.ibm.com/netrexx/
*@author A.J. Bos
*/
beer = "bottles of beer on the wall"
removeOne = "Take one down, pass it arround,"
say 99 beer","
say 99 beer.subword(1,3)","
loop i = 98 to 2 by -1
say removeOne
say i beer"."
say
say i beer","
say i beer.subword(1,3)","
end
lastCall = "bottle" beer.delword(1,1)
say removeOne
say i lastCall"."
say
say i lastCall","
say i lastCall.subword(1,3)","
say removeOne
say "No more" beer
NEWLIB is a programming aid that operates as a command processor in
the Time Sharing Option (TSO) environment. (Mostly based on PL/I,
therefore the similarity.) It is used at DESY/Hamburg and KEK/Tsukuba.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ 21/02/96 602211216 MEMBER NAME <<EDTCL (SPECTRUM) CLIST
$ NEWLIB VERSION OF 99 BOTTLES OF BEER
$ R.P.HOFMANN F15RPH@DSYIBM.DESY.DE
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
STORE
ESC := '%'
DO N0 = 1 TO 99
N1 := 100-%N0
IF N1 > 1 THEN
IF N0 > 1 SHOW N1||' BOTTLES OF BEER ON THE WALL'
SHOW N1||' BOTTLES OF BEER ON THE WALL'
SHOW N1||' BOTTLES OF BEER'
ELSE
SHOW '1 BOTTLE OF BEER ON THE WALL'
SHOW '1 BOTTLE OF BEER ON THE WALL'
SHOW '1 BOTTLE OF BEER'
ENDIF
SHOW 'TAKE 1 DOWN AND PASS IT ALL AROUND'
END
SHOW '0 BOTTLES OF BEER ON THE WALL'
RESTORE
By Walter Smith.
BeerSong := {
Drink: func ()
for b:= 99 to 1 do begin
Print(:Bob(b) & " on the wall, " & :Bob(b) & ".\n");
Print("Take one down, pass it around, " & :Bob(b-1) &
" on the wall.\n");
end,
Bob: func (i)
if i = 0 then
return "no more bottles of beer"
else if i = 1 then
return "1 bottle of beer"
else
return i & " bottles of beer",
};
Nial stands for Nested Interactive Array Language, which incorporates
ideas from APL2, Lisp, FP and structured programming. Q'Nial is a Nial
programming system developed at Queen's University in Canada
<a href="http://www.qucis.queensu.ca/home/nsl/info.html">Click here</a>
for more info.
% Nial (Q'Nial) version of 99 bottles of beer
%;
% loaddef "beer;
% beer 99;
%;
% Hacked by Akira KIDA, SDI00379@niftyserve.or.jp;
bottles IS OPERATION A {
IF A = 0 THEN
'No more bottles'
ELSEIF A = 1 THEN
link (sketch A) ' bottle'
ELSE
link (sketch A) ' bottles'
ENDIF
}
beer IS OPERATION A {
FOR x WITH reverse count A DO
write link (bottles x) ' of beer on the wall, '
(bottles x) '.';
write 'Take one down, pass it around.';
write link (bottles (x - 1)) ' of beer on the wall.';
write '';
ENDFOR;
}
nroff is a text formatting macro language common under UNIX
.\" Tim Goodwin <tim@pipex.net>
.nr BO 99
.de BP
.if \\n(BO=0 No more
.if !\\n(BO=0 \\n(BO
.if \\n(BO=1 bottle
.if !\\n(BO=1 bottles
of beer
..
.de WP
.BP
on the wall
..
.de BE
.WP
.br
.BP
.br
Take one down, pass it around
.br
.nr BO \\n(BO-1
.WP
.sp
.if \\n(BO>0 .BE
..
.BE
@echo off
setlocal
set Number=100
set PluralSuffix=s
:BeerLoop
echo %Number% bottle%PluralSuffix% of beer on the wall,
echo %Number% bottle%PluralSuffix% of beer
echo Take one down and pass it around,
set /a Number=Number-1
if %Number% leq 1 set PluralSuffix=
if %Number% neq 0 (
echo %Number% bottle%PluralSuffix% of beer on the wall
) else (
echo No more bottles of beer
goto :eof)
echo.
goto :BeerLoop
endlocal
50009950010B57001150000A550001930001558001570022000000000000000000000000000000
502300502300502300002300000000FF0000000000000000000000000000000000000000000000
00230050230059012F59003059092059096259096F59097459097459096C590965590928570013
00230000230059097359092959092059096F590966590920590962590965590965590972570013
00230000230059092059096F59096E590920590974590968590965590920590977590961570013
00230000230059096C59096C59092C59090A59090D570013000000000000000000000000000000
00230000230059012F59003059092059096259096F59097459097459096C590965590928570013
00230000230059097359092959092059096F590966590920590962590965590965590972570013
00230000230059092E59090A59090D570013000000000000000000000000000000000000000000
00230000230059095459096159096B59096559092059096F59096E590965590920590964570013
00230000230059096F59097759096E59092C590920590970590961590973590973590920570013
00230000230059096959097459092059096159097259096F59097559096E59096459092C570013
00230000230059090A59090D570013000000000000000000000000000000000000000000000000
00230000230059012F59002F59092059096259096F59097459097459096C590965590928570013
00230000230059097359092959092059096F590966590920590962590965590965590972570013
00230000230059092059096F59096E590920590974590968590965590920590977590961570013
00230000230059096C59096C59092E59090A59090D59090A59090D570013000000000000000000
002300002300930001570012000000000000000000000000000000000000000000000000000000
002300002300570001
Numberix version of 99 Bottles of beer (Bottles.num)
Use only the lines of numbers above
Philipp Winterberg, http://www.winterbergs.de
/*
99 Bottles of Beer on the Wall
==============================
in NWScript (the scripting language used in Bioware's 2002 CRPG
"Neverwinter Nights").
Written by Urpo Lankinen <wwwwolf@iki.fi>
Home page: http://www.iki.fi/wwwwolf/
This script is supposed to be put to a creature's OnConversation
property. Just import this script to a module (I used the name
"sing_99bottles"), make a creature (preferrably a non-hostile one),
Properties->Scripts->OnCoversation to sing_99bottles, and tadah!
In tradition of "the beer list", this tries to be (somewhat) idiomatic
example of NWScript. Since I'm but a beginner in the exciting field
of NWScripting, "Idiomatic" in my mind means the fact that the creature
behaves somewhat predictably and the script also makes it do stuff.
So:
- No "normal" conversation is fired up - the creature starts
singing and shouts it as one-liners. *Loudly*.
- The script uses Action*(). This means that it just floods the
creature's action queue with tons of stuff to do (sing, empty the
beer bottle, and wait for a while), and exits -
the game takes rest of the load. If the player clicks on the creature
again, the action queue is cleared and the creature starts all over
again!
- The creature is animated (uses the drinking animation, of course,
what else!?)
- There's also an example of a creature-based check in the end.
(Dearest fantasy dwarves: Apologies in advance for a
racial stereotype =)
The idea was quickly glanced from nw_c2_default4
(the default chat script). No warranty. =)
WARNING: As demonstrated by the example module, using this script with
many many simultaneous singers can be catastrophic and lead to game
crash. Admittedly, NWN wasn't built with this sort of silliness in
mind =)
This example just floods ~300 items in the object's event queue,
which means the game may not be able to keep up with several singers =(
It will work fine with just one annoying drunkard or a few of them!
*/
#include "NW_I0_GENERIC"
void main()
{
int count;
if (GetListenPatternNumber() == -1 && GetCommandable(OBJECT_SELF))
{
ClearAllActions();
SpeakString("Hey hey hey... *hic* Let me sing you a little song...");
ActionWait(1.5);
// This will flood the action queue... =(
for(count = 99; count > 0; count--) {
ActionSpeakString(IntToString(count) +
" barrels of ale on the wall, " +
IntToString(count) +
" barrels of ale! " +
"Open one up, and fill all tankards, " +
(((count-1) == 0) ? "no more" :
IntToString(count-1)) +
" barrels of ale on the wall!");
ActionPlayAnimation(ANIMATION_FIREFORGET_DRINK);
ActionWait(1.5);
}
// Apologies for a racial stereotype... =)
if(GetRacialType(OBJECT_SELF) == RACIAL_TYPE_DWARF) {
ActionSpeakString("NO MORE BARRELS OF ALE ON THE " +
"WALL? BARTEDNDENEEEER!!! *hic* GET ME "+
"MORE BHEER OR I'LL CRACK SOME SKULLS!");
} else {
ActionSpeakString("No more barrels of ale on the wall, "+
"No more barrels of ale, "+
"Innkeeper just went and bought a lot more, "+
"99 barrels of ale on the wall!");
}
}
}