[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Lemonade stand, now with less yelling



While testing out my basic disassembler, I decided to add .toLowercase() to the output and make a lowercase version of Lemonade stand.  Seems to work fine from what I've played so far.  You might have to undo the mess from the wordwrap.  I can put this on a DSK image for anyone who wants it.  :-)

1 lomem: 14080
5 gosub 10000: gosub 11000: gosub 16000: goto 135
10 rem   <<< Lemonade Stand >>>
15 rem  
20 rem  From an original program
30 rem   by Bob Jamison, of the
40 rem   Minnesota  educational
50 rem    computing consortium
60 rem          *  *  *
70 rem   Modified for the Apple
80 rem       february, 1979
90 rem     by Charlie Kellner
135 dim a(30),l(30),h(30),b(30),s(30),p(30),g(30)
150p9 = 10
160s3 = .15
170s2 = 30
175a2 = 2.00
194c9 = .5
195c2 = 1
300 rem   start of game
310 gosub 12000: for i = 1 to n:b(i) = 0:a(i) = a2: next 
320 if a$ = "y" or a$="Y" then  gosub 13000: goto 400
330 gosub 14000
400 rem   weather report
410sc =  rnd (1)
420 if sc < .6 then sc = 2: goto 460
430 if sc < .8 then sc = 10: goto 460
440sc = 7
460 if d < 3 then sc = 2
470 gosub 15000
490 text : home 
500 rem   start of new day
510d = d + 1
520 print "On day ";d;", the cost of lemonade is ";
540c = 2: if d > 2 then c = 4
550 if d > 6 then c = 5
560 print "$.0";c: print 
570c1 = c * .01
580r1 = 1
600 rem   current events
610 if d <  > 3 then 650
620 print "(Your mother quit giving you free sugar)"
650 if d <  > 7 then 700
660 print "(The price of lemonade mix just went up)"
700 rem   after 2 days things can happen
710 if d > 2 then 2000
800 rem   input values
805 print : poke 34, peek (37)
810 for i = 1 to n
815a(i) = a(i) + .000000001
820g(i) = 1:h(i) = 0
850sti = a(i): gosub 4000: print "Lemonade stand ";i; tab( 26);"Assets ";sti$
855 print 
860 if b(i) = 0 then 890
870 print "You are bankrupt, no decisions"
875 print "for you to make."
876 if n = 1 and a(1) < c then 31111
880 goto 1050
890 print "How many glasses of lemonade do you"
895 print "wish to make ";
900 input l(i)
901 if l(i) < 0 or l(i) > 1000 then 903
902 goto 906
903 print "Come on, let's be reasonable now!!!"
904 print "Try again"
905 goto 890
906 if l(i) <  >  int (l(i)) then 903
910 if l(i) * c1 <  = a(i) then 950
920 print "Think again!!!  You have only ";sti$
930 print "in cash and to make ";l(i);" glasses of"
932 print "lemonade you need $";l(i) * c1;" in cash."
940 goto 890
950 print 
951 print "How many advertising signs (";s3 * 100;" cents"
952 print "each) do you want to make ";
960 input s(i)
961 if s(i) < 0 or s(i) > 50 then 963
962 goto 965
963 print "Come on, be reasonable!!! try again."
964 goto 950
965 if s(i) <  >  int (s(i)) then 963
970 if s(i) * s3 <  = a(i) - l(i) * c1 then 1010
975 print 
980sti = a(i) - l(i) * c1: gosub 4000
985 print "Think again, you have only ";sti$
990 print "in cash left after making your lemonade."
1000 goto 950
1010 print : print "What price (in cents) do you wish to"
1012 print "charge for lemonade ";
1015 input p(i)
1020 if p(i) < 0 or p(i) > 100 then 1022
1021 goto 1024
1022 print "Come on, be reasonable!!! try again."
1023 goto 1010
1024 if p(i) <  >  int (p(i)) then 1022
1025 if c5 = 1 then 1050
1050 vtab 23: input "Would you like to change anything?";a$
1060 if  left$ (a$,1) = "y" or left$ (a$,1) = "Y" then  home :c5 = 1: goto 810
1100 home 
1101 next i
1110c5 = 0: text : home 
1120 print : if sc = 10 and  rnd (1) < .25 then 2300
1130 print "$$ Lemonsville Daily Financial Report $$"
1135 print 
1140 poke 768,152: poke 769,80: call 770
1142 poke 768,128: poke 769,160: call 770
1144 poke 768,152: poke 769,40: call 770
1146 poke 768,144: poke 769,80: call 770
1148 poke 768,128: poke 769,200: call 770
1180 rem   calculate profits
1182 if r2 = 2 then 2290
1183 if r3 = 3 then 2350
1185 for i = 1 to n
1186 if a(i) < 0 then a(i) = 0
1187 if r2 = 2 then 1260
1190 if p(i) >  = p9 then 1220
1200n1 = (p9 - p(i)) / p9 * .8 * s2 + s2
1210 goto 1230
1220n1 = ((p9 ^ 2) * s2 / p(i) ^ 2)
1230w =  - s(i) * c9
1232v = 1 - ( exp (w) * c2)
1234n2 = r1 * (n1 + (n1 * v))
1240n2 =  int (n2 * g(i))
1250 if n2 <  = l(i) then 1270
1260n2 = l(i)
1270m = n2 * p(i) * .01
1280e = s(i) * s3 + l(i) * c1
1290p1 = m - e
1300a(i) = a(i) + p1
1310 if h(i) = 1 then 2300
1320 print 
1321 if b(i) <  > 1 then 1330
1326 print "Stand ";i;: print "   bankrupt": gosub 18000
1327 goto 1390
1330 gosub 5000
1350 if a(i) > c / 100 then 1390
1360 print "Stand ";i
1365 home : print "  ...you don't have enough money left"
1370 print " to stay in business  you're bankrupt!"
1380b(i) = 1
1382 gosub 18000: home 
1385 if n = 1 and b(1) = 1 then 31111
1390 next i
1395r1 = 1
1396r2 = 0
1400 goto 400
2000 rem   random events
2010 if sc = 10 then 2110
2030 if sc = 7 then 2410
2040 if  rnd (1) < .25 then 2210
2050 goto 805
2100 if x1 = 1 then 805
2110j = 30 +  int ( rnd (1) * 5) * 10
2112 print "There is a ";j;"% chance of light rain,"
2115 print "and the weather is cooler today."
2120r1 = 1 - j / 100
2130x1 = 1
2140 goto 805
2200 if x2 = 1 then 805
2210 print "The street department is working today."
2220 print "there will be no traffic on your street."
2230 if  rnd ( - 1) < .5 then 2233
2231r2 = 2
2232 goto 2250
2233r1 = .1
2250x2 = 1
2260 goto 805
2290 print "The street crews bought all your"
2295 print "lemonade at lunchtime!!"
2297 goto 1185
2300 rem   thunderstorm!
2310x3 = 1:r3 = 0
2320sc = 5: gosub 15000: text : home 
2330 print "Weather report:  A severe thunderstorm"
2340 print "hit lemonsville earlier today, just as"
2350 print "the lemonade stands were being set up."
2360 print "unfortunately, everything was ruined!!"
2370 for j = 1 to n:g(j) = 0: next 
2380 goto 1185
2400 if x4 = 1 then 805
2410x4 = 1
2430 print "A heat wave is predicted for today!"
2440r1 = 2
2450 goto 805
3000 end 
4000 rem   sti => dollars.cents
4010sti =  int (sti * 100 + .5) / 100
4020sti$ = "$" +  str$ (sti)
4030 if sti =  int (sti) then sti$ = sti$ + ".0"
4040 if sti =  int (sti * 10 + .5) / 10 then sti$ = sti$ + "0"
4050 return 
5000 vtab 6: poke 34,5
5002 print "   Day ";d; tab( 30);"Stand ";i: print : print 
5010 print "  ";n2; tab( 7);"glasses sold": print 
5012sti = p(i) / 100: gosub 4000: print sti$; tab( 7);"per glass";
5014sti = m: gosub 4000: print  tab( 27);"Income ";sti$
5016 print : print : print "  ";l(i); tab( 7);"Glasses made": print 
5020sti = e: gosub 4000: print "  ";s(i); tab( 7);"Signs made"; tab( 25);"Expenses ";sti$: print : print 
5030sti = p1: gosub 4000: print  tab( 16);"Profit  ";sti$: print 
5040sti = a(i): gosub 4000: print  tab( 16);"Assets  ";sti$
5060 gosub 18000
5070 rem  
5090 home : return 
10000 rem   initialize
10100 poke 770,173: poke 771,48: poke 772,192: poke 773,136: poke 774,208: poke 775,5: poke 776,206: poke 777,1: poke 778,3: poke 779,240: poke 780,9: poke 781,202
10110 poke 782,208: poke 783,245: poke 784,174: poke 785,0: poke 786,3: poke 787,76: poke 788,2: poke 789,3: poke 790,96: poke 791,0: poke 792,0
10190 return 
11000 rem   introduction
11100 text : home : gr : color= 12: for i = 0 to 39: hlin 0,39 at i: next : vtab 2
11110 print ";LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL;LLLLL";
11120 print ";LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL;LLLLL";
11130 print ";LLLL;;;;L;;;;;L;;;;L;;;;L;;;;L;;;;L;;;;";
11140 print ";LLLL;LL;L;L;L;L;LL;L;LL;LLLL;L;LL;L;LL;";
11150 print ";LLLL;;;;L;L;L;L;LL;L;LL;L;;;;L;LL;L;;;;";
11160 print ";LLLL;LLLL;L;L;L;LL;L;LL;L;LL;L;LL;L;LLL";
11170 print ";;;;L;;;;L;LLL;L;;;;L;LL;L;;;;L;;;;L;;;;";
11200 vtab 11
11210 print "LLLLLLLL;;;;;LL;LLLLLLLLLLLLLLL;LLLLLLLL";
11220 print "LLLLLLLL;LLLLLL;LLLLLLLLLLLLLLL;LLLLLLLL";
11230 print "LLLLLLLL;LLLLL;;;L;;;;L;;;;L;;;;LLLLLLLL";
11240 print "LLLLLLLL;;;;;LL;LLLLL;L;LL;L;LL;LLLLLLLL";
11250 print "LLLLLLLLLLLL;LL;LL;;;;L;LL;L;LL;LLLLLLLL";
11260 print "LLLLLLLLLLLL;LL;LL;LL;L;LL;L;LL;LLLLLLLL";
11270 print "LLLLLLLL;;;;;LL;LL;;;;L;LL;L;;;;LLLLLLLL";
11280 vtab 23: print "  Copyright 1979    Apple Computer inc."
11300 gosub 11700: for i = 1 to 2000: next 
11310 poke 33,1: poke 34,9: poke 35,19
11320 for i = 39 to 7 step  - 1: color= 15: vlin 18,37 at i: color= 12: if i < 39 then  vlin 18,36 at i + 1
11330 color= 15: if i < 30 then  vlin 18,36 at i + 10
11340 color= 12: if i < 29 then  vlin 18,37 at i + 11: poke 32,i + 11: vtab 11: htab i + 12: print : read a$: print a$;
11350 for j = 14 to i + i: next : next : for i = 1 to 1000: next 
11360 color= 13: vlin 14,36 at 12: for i = 36 to 20 step  - 1: hlin 8,16 at i
11370 for j = 1 to 50: next : poke 768,i * 3 - 12: poke 769,12: call 770: next : color= 12: vlin 14,19 at 12
11400 poke 32,0: poke 33,40: poke 34,20: poke 35,23: vtab 22
11410 for i = 1 to 4000: next :i =  fre (0)
11490 return 
11500 rem   data
11510 data  96,180,128,60,114,60,128,120,144,60,152,60,128,255,128,60,114,60,85,120,96,60,102,60,114,120,102,60,96,255,0,0
11520 data  ,,,,,,L;LL;,L;LL;,;;LL;;,L;LL;,L;;;;,,,;L;;;;,;L;LL;,;L;LL;,;L;LL;,;;;LL;,,,,,*
11530 data  96,16,85,4,128,4,96,4,76,4,128,4,96,16,0,0
11540 data  114,120,144,60,114,255,1,120,128,120,144,60,128,120,114,60,144,120,171,255,228,255,0,0
11550 data  152,180,152,120,152,60,144,120,152,60,171,120,192,60,152,255,0,0
11560 data  0,160,128,255,152,40,171,80,192,40,228,255,1,40,0,160,192,255,192,40,171,80,152,40,128,255,0,0
11700 rem   music
11710 read i,j: if j = 0 then  return 
11720 poke 768,i: poke 769,j: call 770
11730 goto 11710
12000 rem   title page
12100 text : home : print  chr$ (7);
12110 print "Hi!  Welcome to Lemonsville, California!": print 
12120 print "In this small town, you are in charge of"
12130 print "running your own lemonade stand. You can"
12140 print "compete with as many other people as you"
12150 print "wish, but how much profit you make is up"
12160 print "to you (the other stands' sales will not"
12170 print "affect your business in any way). If you"
12180 print "make the most money, you're the winner!!": print 
12190 print "Are you starting a new game? (yes or no)"
12200 vtab 21: call  - 958: input "Type your answer and hit return ==> ";a$
12210a$ =  left$ (a$,1): if a$ <  > "y" and a$ <  > "n" and a$ < > "Y" and a$ < > "N" then  print  chr$ (7);: goto 12200
12220 vtab 23: call  - 958: input "How many people will be playing ==> ";n$
12230n =  val (n$): if n < 1 or n > 30 then  print  chr$ (7);: goto 12220
12240 return 
13000 rem   new business
13100 home 
13110 print "To manage your lemonade stand, you will "
13120 print "need to make these decisions every day: ": print 
13130 print "1. How many glasses of lemonade to make    (only one batch is made each morning)"
13140 print "2. How many advertising signs to make      (the signs cost fifteen cents each)  "
13150 print "3. What price to charge for each glass  ": print 
13160 print "You will begin with $2.00 cash (assets)."
13170 print "Because your mother gave you some sugar,"
13180 print "your cost to make lemonade is two cents "
13190 print "a glass (this may change in the future).": print 
13200 gosub 18000
13202 home 
13210 print "Your expenses are the sum of the cost of"
13220 print "the lemonade and the cost of the signs. ": print 
13230 print "Your profits are the difference between "
13240 print "the income from sales and your expenses.": print 
13250 print "The number of glasses you sell each day "
13260 print "depends on the price you charge, and on "
13270 print "the number of advertising signs you use.": print 
13280 print "Keep track of your assets, because you  "
13290 print "can't spend more money than you have!   ": print 
13300 gosub 18000
13302 home : return 
14000 rem   continue old game
14100 call  - 936: print  chr$ (7);:i = 0
14110 print "Hi again!  welcome back to Lemonsville! ": print 
14120 print "Let's continue your last game from where"
14130 print "you left it last time.  Do you remember "
14140 print "what day number it was? ";
14150 input "";a$:a =  val (a$): print : if a <  > 0 then 14200
14160a$ =  left$ (a$,1): if a$ = "y" or a$="Y" then  print "good!  what day was it? ";:i = i + 1: goto 14150
14170 if a$ = "n" or i > 0 then 14300
14180 print  chr$ (7);"Yes or No? ";:i = i + 1: goto 14150
14200 if a < 1 or a > 99 or a <  >  int (a) then 14300
14210d = a
14300 print "Okay - we'll start with day no. ";d + 1: print 
14400 for i = 1 to n: print : print 
14410 print "Player no. ";i;", how much money (assets)": print 
14420 print "did you have? ";
14430 input "";a$:a =  val (a$): print 
14440 if a < 2 then  print "O.k. - we'll start you out with $2.00":a = 2: goto 14490
14450 if a > 40 then  print "Just to be fair, let's make that $10.00":a = 10
14490a(i) =  int (a * 100 + .5) / 100: next 
14500 print : print  chr$ (7): input "...ready to begin? ";a$
14510 if  left$ (a$,1) = "n" or left$(a$,1) = "N" then 13000
14520 return 
15000 rem   weather display
15100 gr : home 
15110 color= sc: for i = 0 to 25: hlin 0,39 at i: next i
15120 color= 12: for i = 26 to 39: hlin 0,39 at i: next i
15130 color= 8: for i = 24 to 32: hlin 15,25 at i: next i
15150 color= 13: for i = 17 to 23 step 2: vlin 22,23 at i: next i
15151 if sc = 2 or sc = 7 then 15160
15152 if sc = 10 then  color= 15
15157 if sc = 5 then  color= 0
15158 hlin 6,10 at 2: hlin 4,14 at 3: hlin 7,12 at 4: hlin 22,30 at 4: hlin 20,36 at 5: hlin 23,33 at 6::: gosub 17000: goto 15170
15160 if sc = 7 then  color= 9
15162 hlin 3,5 at 1: hlin 2,6 at 2: for i = 3 to 6: hlin 1,7 at i: next : hlin 2,6 at 7: hlin 3,5 at 8
15170 vtab 22: htab 8: print " Lemonsville Weather Report ": print 
15175 vtab 22: htab 8: print " Lemonsville Weather Report ": print 
15180 if sc = 2 then  htab 18: print " Sunny ";
15182 if sc = 7 then  htab 15: print " Hot and dry ";
15184 if sc = 10 then  htab 17: print " Cloudy ";
15186 if sc = 5 then  htab 14: print " Thunderstorms! ";: gosub 17000
15200 restore 
15210 read a$: if a$ <  > "*" then 15210
15220 if sc <  > 2 then 15300
15230 read i,j: if j = 0 then 15500
15240 for k = 1 to j: poke 768,i: poke 769,10: call 770
15250 for l = k to j: next : next : goto 15230
15300 read i,j: if j <  > 0 then 15300
15310 if sc = 7 then 15400
15320 read i,j: if j <  > 0 then 15320
15330 if sc = 10 then 15400
15340 read i,j: if j <  > 0 then 15340
15400 read i,j: if j = 0 then 15500
15410 if i = 1 then  for i = 1 to j: next : goto 15400
15420 poke 768,i: poke 769,j: call 770
15430 goto 15400
15440 if sc = 5 then  gosub 17000
15500 if sc = 5 then  gosub 17000
15510i =  fre (0): for i = 1 to 2000: next : return 
16000 poke 13824,76: poke 13825,108: poke 13826,54: poke 13827,165: poke 13828,48: poke 13829,41: poke 13830,15: poke 13831,141: poke 13832,160: poke 13833,54:
16010 poke 13834,165: poke 13835,48: poke 13836,41: poke 13837,240: poke 13838,141: poke 13839,161: poke 13840,54: poke 13841,165: poke 13842,36: poke 13843,141:
16020 poke 13844,162: poke 13845,54: poke 13846,165: poke 13847,37: poke 13848,141: poke 13849,163: poke 13850,54: poke 13851,169: poke 13852,0: poke 13853,133:
16030 poke 13854,36: poke 13855,133: poke 13856,37: poke 13857,72: poke 13858,32: poke 13859,193: poke 13860,251: poke 13861,133: poke 13862,40: poke 13863,164:
16040 poke 13864,36: poke 13865,177: poke 13866,40: poke 13867,41: poke 13868,15: poke 13869,205: poke 13870,164: poke 13871,54: poke 13872,208: poke 13873,10:
16050 poke 13874,177: poke 13875,40: poke 13876,41: poke 13877,240: poke 13878,24: poke 13879,109: poke 13880,160: poke 13881,54: poke 13882,145: poke 13883,40:
16060 poke 13884,177: poke 13885,40: poke 13886,41: poke 13887,240: poke 13888,205: poke 13889,165: poke 13890,54: poke 13891,208: poke 13892,10: poke 13893,177:
16070 poke 13894,40: poke 13895,41: poke 13896,15: poke 13897,24: poke 13898,109: poke 13899,161: poke 13900,54: poke 13901,145: poke 13902,40: poke 13903,200:
16080 poke 13904,192: poke 13905,40: poke 13906,144: poke 13907,213: poke 13908,160: poke 13909,0: poke 13910,104: poke 13911,105: poke 13912,0: poke 13913,197:
16090 poke 13914,34: poke 13915,144: poke 13916,196: poke 13917,32: poke 13918,193: poke 13919,251: poke 13920,133: poke 13921,40: poke 13922,173: poke 13923,162:
16100 poke 13924,48: poke 13925,133: poke 13926,36: poke 13927,173: poke 13928,163: poke 13929,54: poke 13930,133: poke 13931,37: poke 13932,165: poke 13933,48:
16110 poke 13934,41: poke 13935,15: poke 13936,141: poke 13937,164: poke 13938,54: poke 13939,165: poke 13940,48: poke 13941,41: poke 13942,240: poke 13943,141:
16120 poke 13944,165: poke 13945,54: poke 13946,96: poke 13947,0:
16130 return 
17000 if sc <  > 5 then  return 
17001 color= 10: vlin 7,9 at 29: hlin 30,31 at 9: vlin 9,14 at 32: hlin 33,34 at 14: vlin 14,25 at 35
17005 vlin 5,8 at 8: plot 9,8: vlin 8,13 at 10: plot 11,13: vlin 13,17 at 12
17010 for rpt = 1 to 5
17020 call 13824
17030 color= 7: call 13827
17040 call 13824
17050 color= 9: call 13827
17060 next rpt
17070 call 13824
17080 color= 5: call 13827
17090 return 
18000 vtab 24: print " Press SPACE to continue, ESC to end...";
18010 get in$: if in$ <  > " " and  asc (in$) <  > 27 then 18010
18020 if  asc (in$) = 27 then 31111
18030 return 
31111 for i = 1 to 2000: next : home : vtab 10: print "Would you like to play again ";
31112 get in$: if in$ = "y" or in$="Y" then 150
31113 if  peek (994) +  peek (1001) = 192 then  call 976
31114 text : home : text : end