http://www.99-bottles-of-beer.net
Maybe we can contribute with a "better" version?!?


Code: Select all
Procedure PlaySong(Music.s, Duration)
For x.l = 1 To Len(Music)
Select Mid(Music, x, 1)
Case "A" : Beep_(220, Duration)
Case "D" : Beep_(147, Duration)
Case "E" : Beep_(165, Duration)
Case "F" : Beep_(185, Duration)
Case "G" : Beep_(196, Duration)
Case "0" : Delay(Duration)
EndSelect
Next x
EndProcedure
OpenConsole()
a$ = " bottle(s) of beer" : ConsoleTitle("99" + a$) : c$ = " on the wall" : ClearConsole()
For b = 99 To 1 Step -1
PrintN(" " + Str(b) + a$ + c$ + ",") : PlaySong("GGGDDDGGGG00", 125)
PrintN(" " + Str(b) + a$ + ".") : PlaySong("AAAEEEA0000", 125)
PrintN(" Take one down, pass it around,") : PlaySong("GFFFFFFFFFF00", 125)
PrintN(Chr(32) + Str(b - 1) + a$ + c$ + Chr(46)) : PlaySong("DDDDEFGGGG00", 125)
PrintN(Chr(32))
Next b
CloseConsole()
End

First I thought: Awesome!Kale wrote:My mod of Philipp Winterberg's code.Don't leave it on too long or you will go insane!
Code: Select all
Procedure PlaySong(Music.s, Duration) For x.l = 1 To Len(Music) Select Mid(Music, x, 1) Case "A" : Beep_(220, Duration) Case "D" : Beep_(147, Duration) Case "E" : Beep_(165, Duration) Case "F" : Beep_(185, Duration) Case "G" : Beep_(196, Duration) Case "0" : Delay(Duration) EndSelect Next x EndProcedure OpenConsole() a$ = " bottle(s) of beer" : ConsoleTitle("99" + a$) : c$ = " on the wall" : ClearConsole() For b = 99 To 1 Step -1 PrintN(" " + Str(b) + a$ + c$ + ",") : PlaySong("GGGDDDGGGG00", 125) PrintN(" " + Str(b) + a$ + ".") : PlaySong("AAAEEEA0000", 125) PrintN(" Take one down, pass it around,") : PlaySong("GFFFFFFFFFF00", 125) PrintN(Chr(32) + Str(b - 1) + a$ + c$ + Chr(46)) : PlaySong("DDDDEFGGGG00", 125) PrintN(Chr(32)) Next b CloseConsole() End

Great!! I must be insane allready?!? :roll: I played it for 30 minutes and liked it more and more...Kale wrote:My mod of Philipp Winterberg's code.Don't leave it on too long or you will go insane!

yeahrsts wrote:Yes - submit it.
BTW - The perl version is incredible.
cheers
Code: Select all
''=~( '(?{' .('`' |'%') .('[' ^'-')
.('`' |'!') .('`' |',') .'"'. '\\$'
.'==' .('[' ^'+') .('`' |'/') .('['
^'+') .'||' .(';' &'=') .(';' &'=')
.';-' .'-'. '\\$' .'=;' .('[' ^'(')
.('[' ^'.') .('`' |'"') .('!' ^'+')
.'_\\{' .'(\\$' .';=('. '\\$=|' ."\|".( '`'^'.'
).(('`')| '/').').' .'\"'.+( '{'^'['). ('`'|'"') .('`'|'/'
).('['^'/') .('['^'/'). ('`'|',').( '`'|('%')). '\".\"'.( '['^('(')).
'\"'.('['^ '#').'!!--' .'\\$=.\"' .('{'^'['). ('`'|'/').( '`'|"\&").(
'{'^"\[").( '`'|""").( '`'|"\%").( '`'|"\%").( '['^(')')). '\").\"'.
('{'^'[').( '`'|"\/").( '`'|"\.").( '{'^"\[").( '['^"\/").( '`'|"\(").(
'`'|"\%").( '{'^"\[").( '['^"\,").( '`'|"\!").( '`'|"\,").( '`'|(',')).
'\"\\}'.+( '['^"\+").( '['^"\)").( '`'|"\)").( '`'|"\.").( '['^('/')).
'+_,\",'.( '{'^('[')). ('\\$;!').( '!'^"\+").( '{'^"\/").( '`'|"\!").(
'`'|"\+").( '`'|"\%").( '{'^"\[").( '`'|"\/").( '`'|"\.").( '`'|"\%").(
'{'^"\[").( '`'|"\$").( '`'|"\/").( '['^"\,").( '`'|('.')). ','.(('{')^
'[').("\["^ '+').("\`"| '!').("\["^ '(').("\["^ '(').("\{"^ '[').("\`"|
')').("\["^ '/').("\{"^ '[').("\`"| '!').("\["^ ')').("\`"| '/').("\["^
'.').("\`"| '.').("\`"| '$')."\,".( '!'^('+')). '\",_,\"' .'!'.("\!"^
'+').("\!"^ '+').'\"'. ('['^',').( '`'|"\(").( '`'|"\)").( '`'|"\,").(
'`'|('%')). '++\\$="})' );$:=('.')^ '~';$~='@'| '(';$^=')'^ '[';$/='`';