Tach allerseits
Ich finde es immer wieder faszinierend, über welch skurile Seiten man (oder auch frau) in den Weiten des Internet so stolpern kann.
Und auch auf die Gefahr hin, daß einigen hier das Nachfolgende schon bekannt sein dürfte:
99 Bottle of beer on the wall,
Take one down and pass it around.
98 Bottle of beer on the wall,
Take one down and pass it around.
...
No bottles of beer on the wall
There are no more to pass around
Go to the store and buy some more.
ist ein Abzählreim (bzw. ein alter Pubsong), der sich im Englischen ähnlicher Beliebtheit erfreut wie die 10 kleinen Jägermeister ähh Negerlein im Deutschen.
In Javascript könnte das z.B. so aussehen:
if (confirm("Are you old enough to read about beer\n" +
"according to your local community standards?")) {
for (i = 99 ; i > 0 ; i--) {
j = i - 1;
if (i != 1) {
icase = "bottles";
} else {
icase = "bottle";
}
if (j != 1) {
jcase = "bottles";
} else {
jcase = "bottle";
}
document.writeln(i + " " + icase + " of beer on the wall,");
document.writeln(i + " " + icase + " of beer,");
document.writeln("Take 1 down, pass it around,");
if (j != 0) {
document.writeln(j + " " + jcase + " of beer on the wall.");
} else {
document.writeln("No more bottles of beer on the wall!");
}
document.writeln()
}
} else {
document.write("You might want think about moving to another community.")
}
Zwar findet man im Internet immer wieder vereinzelte Versionen in diversen Programmiersprachen, aber diese Seite war mir neu:
http://internet.ls-la.net/mirrors/99bottles/.
Angefangen von A+ über EMACS Lisp bis hin zu YACC hat der Autor die "99 Bottle of beer on the wall" in 127 Programmiersprachen zusammengetragen.
Wer einen postscriptfähigen Drucker besitzt, kann z.B. mal folgendes probieren:
%!PS
% The 99 bottles of beer song in PostScript. This file
% can be sent to a PostScript printer (it'll be about
% eight pages or so...)
% Stuart Morris
% ------------- Variables & Procedures ------------
/LM 72 def % left margin
/ypos 720 def % initial top position
/BM 72 def % bottom margin
/lineheight 18 def % height of a line of text
% starts a new line
/crlf
{
ypos lineheight sub
/ypos exch def
LM ypos moveto
} def
% starts a new page if current one is full
/newpage?
{
ypos BM lt
{
showpage
/ypos 720 def
LM ypos moveto
} if
} def
% returns the correct syntax of the bottle
% string ("bottle" if one, "bottles" otherwise)
/bottlestring % stack: number of bottles
{
1 eq
{
( bottle of beer)
}
{
( bottles of beer)
} ifelse
} def
% ------------- Main Program ----------------
LM ypos moveto
/Times-Roman findfont
lineheight 2 sub scalefont
setfont
99 -1 1
{
/numbottles 2 string def
dup numbottles cvs show
dup bottlestring show ( on the wall, ) show
numbottles show dup bottlestring show (,) show
crlf
(Take one down, pass it around, ) show
1 sub dup numbottles cvs show
bottlestring show ( on the wall.) show
crlf crlf
newpage?
} for
showpage
Diesen Quelltext in einen ASCII-Editor kopieren und als *.ps-Datei oder *.prn-Datei abspeichern und zum Drucker schicken. Ergibt 8 Seiten...
Thomas J.