Author Topic: 99 Bottles of Beer  (Read 415 times)

jj2007

  • Member
  • *****
  • Posts: 13274
  • Assembly is fun ;-)
    • MasmBasic
Re: 99 Bottles of Beer
« Reply #15 on: November 21, 2022, 03:50:44 AM »
I hope this challenge is open to think outside the box,99 bottles with a twist, not create program with exact same output?
here is my way,english isnt my native language

I am tempted to write a macro that converts 25 to "twenty-five" :tongue:

Code: [Select]
    switch seconddigit
    case 2
    print "twenty"
    case 3
    print "thirty"
    case 4
    print "forty"
    case 5
    print "fifty"
Masm32 Tips, Tricks and Traps

Some members can't live without insulting others. It tells us a lot about them.

jj2007

  • Member
  • *****
  • Posts: 13274
  • Assembly is fun ;-)
    • MasmBasic
99 Bottles of Beer - text version
« Reply #16 on: November 21, 2022, 11:55:36 AM »
There it is, the NumberAsText$ macro :tongue:

Code: [Select]
Ninety-Nine bottles of beer on the wall, ninety-nine bottles of beer.
Take one down and pass it around, ninety-eight bottles of beer on the wall.

Ninety-Eight bottles of beer on the wall, ninety-eight bottles of beer.
Take one down and pass it around, ninety-seven bottles of beer on the wall.
...
Two bottles of beer on the wall, two bottles of beer.
Take one down and pass it around, 1 bottle of beer on the wall.

One bottle of beer on the wall, one bottle of beer.
Take one down and pass it around,  bottles of beer on the wall.

No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.

Code: [Select]
include \masm32\MasmBasic\MasmBasic.inc
  Init
  For_ ecx=99 To 1 Step -1
.if ecx==1
Print cfm$("One bottle of beer on the wall, one bottle of beer.\n")
.else
Print TitleCase$(NumberAsText$(ecx))
PrintLine " bottles of beer on the wall, ", NumberAsText$(ecx), " bottles of beer."
.endif
.if ecx==2
Print cfm$("Take one down and pass it around, 1 bottle of beer on the wall.\n\n")
.else
lea eax, [ecx-1]
PrintLine "Take one down and pass it around, ", NumberAsText$(eax), cfm$(" bottles of beer on the wall.\n")
.endif
  Next
  PrintLine "No more bottles of beer on the wall, no more bottles of beer."
  Inkey "Go to the store and buy some more, 99 bottles of beer on the wall."
EndOfCode
Masm32 Tips, Tricks and Traps

Some members can't live without insulting others. It tells us a lot about them.

bluedevil

  • Member
  • **
  • Posts: 199
  • Binary Grinder
    • SCTZine
Re: 99 Bottles of Beer
« Reply #17 on: November 21, 2022, 05:16:16 PM »
Now we need a line by line scrolling text of the song, accompanied by a synced MP3 of it playing in the background sung by a group of drunkards.  :toothy:  Beyond my coding capabilities, btw.  :tongue:
I thought that was made Saturday evening while party record singing, and change text from "press any key" to "don't sing off key"  :tongue:
 :greenclp:

I hope this challenge is open to think outside the box,99 bottles with a twist, not create program with exact same output?
here is my way,english isnt my native language

Hello @daydreamer
I love the way do it. But you have missed things?
1. New lines. After two line there should be a newline
2. You should decrement bottle number in the second line, look:
Code: [Select]
three  bottles of beer on the wall. three  bottles of beer.
take one down and pass it around. three  bottles of beer on the wall
Look at your second line, you took one and pass it around[the bottle], and you have still three bottles. It should be two bottles.
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github

bluedevil

  • Member
  • **
  • Posts: 199
  • Binary Grinder
    • SCTZine
Re: 99 Bottles of Beer
« Reply #18 on: November 21, 2022, 05:18:39 PM »
Now we need a line by line scrolling text of the song, accompanied by a synced MP3 of it playing in the background sung by a group of drunkards.  :toothy:  Beyond my coding capabilities, btw.  :tongue:
I thought that was made Saturday evening while party record singing, and change text from "press any key" to "don't sing off key"  :tongue:
 :greenclp:

I hope this challenge is open to think outside the box,99 bottles with a twist, not create program with exact same output?
here is my way,english isnt my native language

Hello @daydreamer
I love the way do it. But you have missed things?
1. New lines. After two line there should be a newline
2. You should decrement bottle number in the second line, look:
Code: [Select]
three  bottles of beer on the wall. three  bottles of beer.
take one down and pass it around. three  bottles of beer on the wall
Look at your second line, you took one and pass it around[the bottle], and you have still three bottles. It should be two bottles.

@jj2007, this is beautiful, you only missed "no more" here:
Code: [Select]
One bottle of beer on the wall, one bottle of beer.
Take one down and pass it around,  bottles of beer on the wall.
                                                  ^
                                             no more
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github

daydreamer

  • Member
  • *****
  • Posts: 2185
  • my kind of REAL10 Blonde
99 bottles of sake
« Reply #19 on: November 23, 2022, 05:44:28 AM »
Hi
I corrected some and progressed with 99 bottles of sake :greenclp:
my none asm creations
http://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."

bluedevil

  • Member
  • **
  • Posts: 199
  • Binary Grinder
    • SCTZine
Re: 99 bottles of sake
« Reply #20 on: November 23, 2022, 07:06:52 AM »
Hi
I corrected some and progressed with 99 bottles of sake :greenclp:

sake? I am in. But where is the code. Let us try the codes.
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 9988
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: 99 Bottles of Beer
« Reply #21 on: November 23, 2022, 10:50:12 AM »
 :biggrin:

Try is with 99 bottles of Raki but I doubt you would make it to bottle 99.  :tongue:
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

daydreamer

  • Member
  • *****
  • Posts: 2185
  • my kind of REAL10 Blonde
Re: 99 bottles of sake
« Reply #22 on: November 24, 2022, 01:59:36 AM »
Hi
I corrected some and progressed with 99 bottles of sake :greenclp:

sake? I am in. But where is the code. Let us try the codes.
Updated previous zip file with two proc's
Japanese version of numbers to text and alternative 99 bottles of sake in karaoke bar
my none asm creations
http://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."

bluedevil

  • Member
  • **
  • Posts: 199
  • Binary Grinder
    • SCTZine
Re: 99 Bottles of Beer
« Reply #23 on: November 24, 2022, 02:01:41 AM »
:biggrin:

Try is with 99 bottles of Raki but I doubt you would make it to bottle 99.  :tongue:

 :eusa_dance:
When I was younger, yes I can finish the 99th bottle(but only the 99th), but now i could not finish even only one!  :bgrin: thanks for reminding :D
..Dreams make the future
But the past never lies..
BlueDeviL // SCT
My Code Site:
BlueDeviL Github