Author Topic: Lemonade Stand  (Read 5277 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Lemonade Stand
« on: July 21, 2019, 08:07:51 pm »
Do you guys remember this simulation back in the mid-80's? In 1999 I re-created it using ASIC 5.0 making my own version and today I enhanced it a little bit and changed it for QB64. :)
There's no time limit on this game, you can play as long as you still have money, kinda like Monopoly lol.
It might be too easy, it might be too hard, it's very random, but buying advertisements does help as well as selling for a cheap price. But there's also a 15% chance per round that a huge gust of wind will come and destroy one of your advertisements. hehehe
Code: QB64: [Select]
  1. ' This program was made after midnight on May 17, 1999
  2. ' It was created because about 10 years before that I played a similar
  3. ' program when computer games had hardly any graphics on them.
  4. ' This program has no graphics, but is really fun!
  5. ' This game was adapted for QB64 on July 21, 2019.
  6. _TITLE "Lemonade Stand"
  7. m = 20
  8. PRINT "                   Lemonade Stand"
  9. PRINT "                     By Ken G."
  10. PRINT "This program is a business simulation for all ages."
  11. PRINT "Learn how to spend and keep money to make more money by"
  12. PRINT "selling lemonade. The buyers come mostly at random, but also"
  13. PRINT "are effected on how much advertising you do."
  14. PRINT "You are started out with $20, a table, a chair, free unlimited"
  15. PRINT "water to mix the lemonade, a fairly good street to sell to,"
  16. PRINT "a glass pitcher, and a friend to help you go buy lemonade and put"
  17. PRINT "up ads on sign posts and to yell for customers."
  18. PRINT "Plus this is a pretend world so you can sell as long as you want or"
  19. PRINT "sell until your money runs out. At the end, it will total your money."
  20. PRINT "Hint: The more ad signs you put up, the more customers you will get."
  21. PRINT "If you don't get any customers for a long time, well sometimes"
  22. PRINT "people just don't want something to drink!"
  23. PRINT "Remember that the higher you charge, the less customers you will have."
  24. PRINT "Also, city ordinances say no more than 4 advertisements per game."
  25. INPUT "Press enter to begin.", a$
  26. l = 0
  27. go:
  28. PRINT "                          Lemonade Stand"
  29. wind = INT(RND * 100) + 1
  30. IF wind > 85 AND aa > 0 THEN
  31.     PRINT "A huge gust of wind just came and blew over 1 of your advertisements"
  32.     PRINT "and a vehicle ran over it making it useless."
  33.     aa = aa - 1
  34.     PRINT "You now have "; aa; " advertisements left."
  35. PRINT "Money: ";
  36. IF l < 1 THEN GOTO lll:
  37. PRINT "Type your price per glass you will charge here (only numbers):";
  38. IF ch > 10 THEN
  39.     PRINT "Your price is way too high, I will set it at $10 per glass."
  40.     ch = 10
  41. IF ch < 1 THEN
  42.     PRINT "Your price is under $1 which these days isn't very profitable."
  43.     PRINT "I will set it as $1."
  44.     ch = 1
  45. PRINT "Glasses Of Lemonade To Sell: ";
  46. PRINT "Amount of Advertisements you have: ";
  47. PRINT "------------------------------------------------------------"
  48. GOTO am:
  49.  
  50. lll:
  51. IF l < 1 THEN
  52.     PRINT "You currently have no lemonade."
  53.     IF m < 3 THEN
  54.         PRINT "You also don't have enough money to buy lemonade that could cost"
  55.         PRINT "as much as $3 a pitcher."
  56.         PRINT "Press enter to quit the game.";
  57.         INPUT qgg$
  58.         GOTO done:
  59.     END IF
  60.     PRINT "Press enter to go buy lemonade.";
  61.     INPUT gb$
  62.     GOTO buylemonade:
  63.  
  64. am:
  65. r = INT(RND * 20) + 1
  66. IF ch > 6 THEN
  67.     w = 7
  68.     GOTO nex:
  69. w = ch
  70. nex:
  71. r = r + s
  72. r = INT(r - w)
  73. IF r < 10 THEN
  74.     r = 0
  75. PRINT "You have ";
  76. IF r > 1 THEN PRINT " customers at the moment."
  77. IF r = 1 THEN PRINT " customer at the moment."
  78. IF r = 0 THEN PRINT " customers at the moment."
  79. PRINT "------------------------------------------------------------"
  80.  
  81. IF r > l THEN
  82.     r = l
  83.     PRINT "You just ran out of lemonade, but you were able to sell"
  84.     PRINT "to "; r; " customers."
  85.     mm = ch * r
  86.     m = m + mm
  87.     PRINT "You now have "; m;
  88.     IF m > 1 THEN PRINT " dollars."
  89.     IF m < 2 THEN PRINT " dollar."
  90.     l = 0
  91.     GOTO lll:
  92. mm = ch * r
  93. m = m + mm
  94. l = INT(l - r)
  95. PRINT "Now you have: ";
  96. PRINT " dollars."
  97. PRINT "Now you have: ";
  98. PRINT " glasses of lemonade left."
  99. check:
  100. PRINT "(1) Buy 1 Pitcher of Lemonade"
  101. PRINT "(2) Buy 1 Advertisement Sign"
  102. PRINT "(3) Keep Selling"
  103. PRINT "(4) End Game"
  104. PRINT "Type a number here and press enter:";
  105. INPUT num
  106. IF num = 1 THEN GOTO buylemonade:
  107. IF num = 2 THEN GOTO buyad:
  108. IF num = 3 THEN GOTO go:
  109. IF num = 4 THEN GOTO done:
  110. GOTO check:
  111. buylemonade:
  112. le = INT(RND * 3) + 1
  113. PRINT "Currently, a pitcher of lemonade costs ";
  114. PRINT le;
  115. IF le < 1 THEN PRINT " dollars."
  116. IF le = 1 THEN PRINT " dollar."
  117. IF le > 1 THEN PRINT " dollars."
  118. IF le > m THEN
  119.     PRINT "Sorry, but you don't have enough money to buy any more."
  120.     GOTO done:
  121. PRINT "You buy 1 pitcher of lemonade."
  122. PRINT "One pitcher equals 20 glasses."
  123. m = INT(m - le)
  124. PRINT "Now you have ";
  125. PRINT " dollars."
  126. l = l + 20
  127. PRINT "You have ";
  128. PRINT " amounts of glasses to sell now."
  129. PRINT "Press enter to go back to main screen.";
  130. INPUT gb$
  131. GOTO go:
  132. buyad:
  133. IF aa = 4 THEN
  134.     PRINT "Sorry but due to the enormous amount of garbage on the street,"
  135.     PRINT "the city says you have the limit number of advertisements."
  136.     PRINT "Press enter to continue.";
  137.     INPUT ag$
  138.     GOTO go:
  139. PRINT "Advertisements costs $4 each."
  140. PRINT "They add your profit because you get more customer attention."
  141. IF m < 4 THEN
  142.     PRINT "Sorry, currently you have less than $4."
  143.     PRINT "Press enter to go back to main menu.";
  144.     INPUT bs$
  145.     GOTO go:
  146. m = m - 4
  147. aa = aa + 1
  148. PRINT "You just bought 1 advertisement."
  149. PRINT "You now have: ";
  150. PRINT " dollars left."
  151. PRINT "Press enter to go back to main screen.";
  152. INPUT gg$
  153. s = s + 1
  154. GOTO go:
  155. done:
  156. PRINT "                Lemonade Stand"
  157. PRINT "Your total money: ";
  158. PRINT " dollars."
  159. PRINT "You started with 20 dollars."
  160. ppr = m - 20
  161. IF ppr < 1 THEN
  162.     PRINT "You didn't make any money."
  163.     PRINT "Good luck next game!"
  164.     GOTO ddone:
  165. PRINT "Your total profit is ";
  166. PRINT ppr;
  167. PRINT " dollars!"
  168. ddone:
  169. PRINT "Come back soon!"
  170. PRINT "Press enter to quit program.";
  171. INPUT qp$
  172.  
« Last Edit: July 21, 2019, 08:10:14 pm by SierraKen »

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: Lemonade Stand
« Reply #1 on: July 21, 2019, 08:36:31 pm »
I made $3622...it wouldn't let me sell it for $20/glass

Finally, a game I'm good at! ;)

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Lemonade Stand
« Reply #2 on: July 21, 2019, 08:57:12 pm »
LOL awesome Old Moses! Yeah the limit is $10 a glass and the least you can sell is $1.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Lemonade Stand
« Reply #3 on: July 21, 2019, 09:14:01 pm »
Well, like they all say, "When life hands you lemons, make lemonade." Life handed me a sack of crap once, but it turned out juicy it didn't improve the situation in the least.

I quit at $500. I had 6 glasses of lemonade left. I'll sell them to anyone on the forum for 12,000 a glass, glass included! Don't all line up at once, it pretty freakin' windy out today!

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Lemonade Stand
« Reply #4 on: July 21, 2019, 10:00:00 pm »
Dang you guys been playing a lot of this game. The most I've ever gotten was probably $100. lol :))

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Lemonade Stand
« Reply #5 on: July 21, 2019, 10:13:38 pm »
I got tired of selling lemonade at $2000+ and sold the business (and secret to my success) to my assistant for $1M he is thinking of changing the product to coffee and calling it Starbucks.

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Lemonade Stand
« Reply #6 on: July 22, 2019, 08:30:06 am »
Nice game. I usually don't like ASCII type game, but I enjoyed this. :)
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Lemonade Stand
« Reply #7 on: July 22, 2019, 10:16:28 am »
I started AI program for this particular coding:
Code: [Select]
OPTION _EXPLICIT
_TITLE "The Secret to My Success in the Lemonade Business by bplus" '2019-07-21
'1. Always sell at $6
'2. If you don't have to buy lemonade buy max amount of ads
'3. Always keep 30 glasses of lemonade on hand (if you can!)


Following these and changing:
Code: QB64: [Select]
  1. ' Input "Price of glass of lemonade ";ch
  2. ch = 6

I made over $16K in 5 minutes or so. $6 is highest you can charge without being penalized by drop in customers. Selling just 1 more lemonade because you have ad justifies expense with first customer who basically pays for ad AND cost of a pitcher of lemonade, the next 19 glasses are profit.




« Last Edit: July 22, 2019, 10:22:33 am by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Lemonade Stand
« Reply #8 on: July 22, 2019, 01:44:20 pm »
LOL awesome B+. Yep just like a real company, you are in the red for awhile first. Did your A.I. encounter any huge gusts of wind? lol
« Last Edit: July 22, 2019, 01:46:02 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Lemonade Stand
« Reply #9 on: July 22, 2019, 01:45:17 pm »
Thanks Ashish, yeah I normally don't make text games, but this is a classic. :)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Lemonade Stand
« Reply #10 on: July 22, 2019, 03:13:22 pm »
LOL awesome B+. Yep just like a real company, you are in the red for awhile first. Did your A.I. encounter any huge gusts of wind? lol

Several ads lost but I was too busy trying to keep up with having enough lemonade to sell. All businesses should have such problems!

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: Lemonade Stand
« Reply #11 on: July 22, 2019, 04:26:41 pm »
That's how it was for me, I couldn't keep the signs or the lemonade for long, but the customers were mobbing me. I started out by selling for $1 for a long time. It must have built a good base.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Lemonade Stand
« Reply #12 on: July 22, 2019, 05:39:54 pm »
Gasp I have tried to sell lemonade but as soon as I'm starting  I must pay 2000$ for taxes! No startup! No wellfare for new business, only burocracy and taxes before to start! :-(
Programming isn't difficult, only it's  consuming time and coffee