News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

99 Bottles of Beer

Started by bluedevil, November 18, 2022, 10:22:20 PM

Previous topic - Next topic

jj2007

Quote from: daydreamer on November 21, 2022, 02:47:09 AMI 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:

    switch seconddigit
    case 2
    print "twenty"
    case 3
    print "thirty"
    case 4
    print "forty"
    case 5
    print "fifty"

jj2007

There it is, the NumberAsText$ macro :tongue:

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.


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

bluedevil

Quote from: daydreamer on November 21, 2022, 02:47:09 AM
Quote from: zedd151 on November 21, 2022, 12:46:04 AM
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:

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

Quote from: bluedevil on November 21, 2022, 05:16:16 PM
Quote from: daydreamer on November 21, 2022, 02:47:09 AM
Quote from: zedd151 on November 21, 2022, 12:46:04 AM
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:

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:

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

Hi
I corrected some and progressed with 99 bottles of sake :greenclp:
my none asm creations
https://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."
Like SIMD coding

bluedevil

Quote from: daydreamer on November 23, 2022, 05:44:28 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--

 :biggrin:

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

daydreamer

Quote from: bluedevil on November 23, 2022, 07:06:52 AM
Quote from: daydreamer on November 23, 2022, 05:44:28 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
https://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."
Like SIMD coding

bluedevil

Quote from: hutch-- 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:

: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