Page 1 of 1

99 Bottles of Beer

Posted: Wed Jan 11, 2006 12:37 am
by techjunkie
Nice! PureBasic is represented, but no music and a bad score. :cry:

http://www.99-bottles-of-beer.net

Maybe we can contribute with a "better" version?!? :)

Posted: Wed Jan 11, 2006 1:47 am
by Kale
My mod of Philipp Winterberg's code. :P 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
:twisted:

Posted: Wed Jan 11, 2006 2:41 am
by Straker
I for one, say "Submit it!"

Posted: Wed Jan 11, 2006 6:07 am
by DarkDragon
Kale wrote:My mod of Philipp Winterberg's code. :P 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
:twisted:
First I thought: Awesome!
Now I think: You can do a screensaver with it and no thief will take your computer if it's running(he goes insane before).

Posted: Wed Jan 11, 2006 11:39 am
by techjunkie
Kale wrote:My mod of Philipp Winterberg's code. :P Don't leave it on too long or you will go insane!
Great!! I must be insane allready?!? :roll: I played it for 30 minutes and liked it more and more... :lol:

Posted: Wed Jan 11, 2006 11:40 am
by traumatic
techjunkie wrote:Great!! I must be insane allready?!? :roll: I played it for 30 minutes and liked it more and more... :lol:
Don't worry, that's normal considering your age... :P

Posted: Wed Jan 11, 2006 1:38 pm
by rsts
Yes - submit it.

BTW - The perl version is incredible.

cheers

Posted: Thu Jan 12, 2006 7:30 am
by Tranquil
Huh, your PureBasic code is places on the Top-Lists No.1 :D

PB roXX. :lol:

Posted: Tue Nov 21, 2006 1:14 am
by Kale

Posted: Tue Nov 21, 2006 2:22 am
by JCV
rsts wrote:Yes - submit it.

BTW - The perl version is incredible.

cheers
yeah :D
I run it and it works.

Code: Select all

    ''=~(        '(?{'        .('`'        |'%')        .('['        ^'-')
    .('`'        |'!')        .('`'        |',')        .'"'.        '\\$'
    .'=='        .('['        ^'+')        .('`'        |'/')        .('['
    ^'+')        .'||'        .(';'        &'=')        .(';'        &'=')
    .';-'        .'-'.        '\\$'        .'=;'        .('['        ^'(')
    .('['        ^'.')        .('`'        |'"')        .('!'        ^'+')
   .'_\\{'      .'(\\$'      .';=('.      '\\$=|'      ."\|".(      '`'^'.'
  ).(('`')|    '/').').'    .'\"'.+(    '{'^'[').    ('`'|'"')    .('`'|'/'
 ).('['^'/')  .('['^'/').  ('`'|',').(  '`'|('%')).  '\".\"'.(  '['^('(')).
 '\"'.('['^  '#').'!!--'  .'\\$=.\"'  .('{'^'[').  ('`'|'/').(  '`'|"\&").(
 '{'^"\[").(  '`'|""").(  '`'|"\%").(  '`'|"\%").(  '['^(')')).  '\").\"'.
 ('{'^'[').(  '`'|"\/").(  '`'|"\.").(  '{'^"\[").(  '['^"\/").(  '`'|"\(").(
 '`'|"\%").(  '{'^"\[").(  '['^"\,").(  '`'|"\!").(  '`'|"\,").(  '`'|(',')).
 '\"\\}'.+(  '['^"\+").(  '['^"\)").(  '`'|"\)").(  '`'|"\.").(  '['^('/')).
 '+_,\",'.(  '{'^('[')).  ('\\$;!').(  '!'^"\+").(  '{'^"\/").(  '`'|"\!").(
 '`'|"\+").(  '`'|"\%").(  '{'^"\[").(  '`'|"\/").(  '`'|"\.").(  '`'|"\%").(
 '{'^"\[").(  '`'|"\$").(  '`'|"\/").(  '['^"\,").(  '`'|('.')).  ','.(('{')^
 '[').("\["^  '+').("\`"|  '!').("\["^  '(').("\["^  '(').("\{"^  '[').("\`"|
 ')').("\["^  '/').("\{"^  '[').("\`"|  '!').("\["^  ')').("\`"|  '/').("\["^
 '.').("\`"|  '.').("\`"|  '$')."\,".(  '!'^('+')).  '\",_,\"'  .'!'.("\!"^
 '+').("\!"^  '+').'\"'.  ('['^',').(  '`'|"\(").(  '`'|"\)").(  '`'|"\,").(
 '`'|('%')).  '++\\$="})'  );$:=('.')^  '~';$~='@'|  '(';$^=')'^  '[';$/='`';

http://search.cpan.org/dist/Acme-EyeDro ... yeDrops.pm