In our August challenge:
We had a...
Challenge from Nonki:
- Create a 99 Bottles of Beer program.
NaochanON's solution:
1st way
Mes="0= no more ;1= bottle of beer ;2= bottles of beer;3= on the wall ;4= Take one down and pass it around, ;5= Go to the store and buy some more, "
CRLF= Text.GetCharacter(13)+Text.GetCharacter(10)
For i=99 To 2 Step -1
TextWindow.WriteLine(i+Mes[Math.Min(i,2)]+Mes[3]+", "+i+Mes[Math.Min(i,2)]+"."+CRLF+Mes[4]+(i-1)+Mes[Math.Min(i-1,2)]+Mes[3]+"."+CRLF+CRLF)
EndFor
TextWindow.WriteLine(i+Mes[Math.Min(i,2)]+Mes[3]+", "+i+Mes[Math.Min(i,2)]+"."+CRLF+Mes[4]+Mes[Math.Min(i-1,2)]+mes[2]+Mes[3]+"."+CRLF+CRLF)
TextWindow.WriteLine(Mes[0]+Mes[2]+mes[3]+", "+Mes[0]+Mes[2]+"."+CRLF+Mes[5]+" 99"+Mes[2]+mes[3]+".")
2nd way
For i=99 To 1 Step -1
Mes="0= no more bottles;1="+i+" bottle;2="+i+" bottles;3= of beer ;4= on the wall ;5= Take one down and pass it around, ;6= Go to the store and buy some more, "
Mes2="0= no more bottles;1="+(i-1)+" bottle ;2="+(i-1)+" bottles;3="+Text.GetCharacter(13)+Text.GetCharacter(10)
TextWindow.WriteLine(Mes[Math.Min(i,2)]+Mes[3]+Mes[4]+", "+Mes[Math.Min(i,2)]+Mes[3]+"."+Mes2[3]+Mes[5]+Mes2[Math.Min(i-1,2)]+Mes[3]+Mes[4]+"."+Mes2[3]+Mes2[3])
EndFor
TextWindow.WriteLine(Mes[Math.Min(i,2)]+mes[3]+Mes[4]+", "+Mes[Math.Min(i,2)]+mes[3]+"."+Mes2[3]+Mes[6]+" 99 bottles of beer on the wall.")
Special thanks to LitDev for hosting the challenge, to Nonki for providing this challenge, and to NaochanON for the solution! Check out NaochanON's MSDN profile:
Take Small Basic down and pass it around!
- Ninja Ed