Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
282 lines (281 sloc) 9.31 KB
5 GOSUB 11000: 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)
150 P9 = 10
160 S3 = .15
170 S2 = 30
175 A2 = 2.00
194 C9 = .5
195 C2 = 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" THEN GOSUB 13000: GOTO 400
330 GOSUB 14000
400 REM WEATHER REPORT
410 SC = RND (1)
420 IF SC < .6 THEN SC = 2: GOTO 460
430 IF SC < .8 THEN SC = 10: GOTO 460
440 SC = 7
460 IF D < 3 THEN SC = 2
470 GOSUB 15000
490 CLS
500 REM START OF NEW DAY
510 D = D + 1
520 PRINT "ON DAY ";D;", THE COST OF LEMONADE IS ";
540 C = 2: IF D > 2 THEN C = 4
550 IF D > 6 THEN C = 5
560 PRINT "$.0";C: PRINT
570 C1 = C * .01
580 R1 = 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
810 FOR I = 1 TO N
815 A(I) = A(I) + .000000001
820 G(I) = 1:H(I) = 0
850 STI = A(I): GOSUB 4000: PRINT "LEMONADE STAND ";I;" 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
980 STI = 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 INPUT "WOULD YOU LIKE TO CHANGE ANYTHING?";A$
1060 IF LEFT$ (A$,1) = "Y" THEN C5 = 1: GOTO 810
1100 CLS
1101 NEXT I
1110 C5 = 0: CLS
1120 PRINT : IF SC = 10 AND RND (1) < .25 THEN 2300
1130 PRINT "** LEMONSVILLE DAILY FINANCIAL REPORT **"
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
1200 N1 = (P9 - P(I)) / P9 * .8 * S2 + S2
1210 GOTO 1230
1220 N1 = ((P9 ^ 2) * S2 / P(I) ^ 2)
1230 W = - S(I) * C9
1232 V = 1 - ( EXP (W) * C2)
1234 N2 = R1 * (N1 + (N1 * V))
1240 N2 = INT (N2 * G(I))
1250 IF N2 < = L(I) THEN 1270
1260 N2 = L(I)
1270 M = N2 * P(I) * .01
1280 E = S(I) * S3 + L(I) * C1
1290 P1 = M - E
1300 A(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 PRINT " ...YOU DON'T HAVE ENOUGH MONEY LEFT"
1370 PRINT " TO STAY IN BUSINESS YOU'RE BANKRUPT!"
1380 B(I) = 1
1382 GOSUB 18000: CLS
1385 IF N = 1 AND B(1) = 1 THEN 31111
1390 NEXT I
1395 R1 = 1
1396 R2 = 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
2110 J = 30 + INT ( RND (1) * 5) * 10
2112 PRINT "THERE IS A ";J;"% CHANCE OF LIGHT RAIN,"
2115 PRINT "AND THE WEATHER IS COOLER TODAY."
2120 R1 = 1 - J / 100
2130 X1 = 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
2231 R2 = 2
2232 GOTO 2250
2233 R1 = .1
2250 X2 = 1
2260 GOTO 805
2290 PRINT "THE STREET CREWS BOUGHT ALL YOUR"
2295 PRINT "LEMONADE AT LUNCHTIME!!"
2297 GOTO 1185
2300 REM THUNDERSTORM!
2310 X3 = 1:R3 = 0
2320 SC = 5: GOSUB 15000: CLS
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
2410 X4 = 1
2430 PRINT "A HEAT WAVE IS PREDICTED FOR TODAY!"
2440 R1 = 2
2450 GOTO 805
3000 END
4000 REM STI => DOLLARS.CENTS
4010 STI = INT (STI * 100 + .5) / 100
4020 STI$ = "$" + 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 REM
5002 PRINT "DAY ";D; " STAND ";I: PRINT : PRINT
5010 PRINT N2; " GLASSES SOLD": PRINT
5012 STI = P(I) / 100: GOSUB 4000: PRINT STI$; " PER GLASS";
5014 STI = M: GOSUB 4000: PRINT ", INCOME ";STI$
5016 PRINT : PRINT L(I); " GLASSES MADE": PRINT
5020 STI = E: GOSUB 4000: PRINT S(I); " SIGNS MADE"; ", EXPENSES ";STI$: PRINT : PRINT
5030 STI = P1: GOSUB 4000: PRINT "PROFIT: ";STI$
5040 STI = A(I): GOSUB 4000: PRINT "ASSETS: ";STI$
5050 PRINT
5060 GOSUB 18000
5070 REM
5090 RETURN
11000 REM INTRODUCTION
11100 CLS
11270 REM PRINT " LEMONADE STAND";
11280 REM PRINT "COPYRIGHT 1979 APPLE COMPUTER INC."
11490 RETURN
12000 REM TITLE PAGE
12100 CLS
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 INPUT "TYPE YOUR ANSWER AND HIT RETURN ==> ";A$
12210 A$ = LEFT$ (A$,1): IF A$ < > "Y" AND A$ < > "N" THEN PRINT CHR$ (7);: GOTO 12200
12220 INPUT "HOW MANY PEOPLE WILL BE PLAYING ==> ";N$
12230 N = VAL (N$): IF N < 1 OR N > 30 THEN PRINT CHR$ (7);: GOTO 12220
12240 RETURN
13000 REM NEW BUSINESS
13100 CLS
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 CLS
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 CLS : RETURN
14000 REM CONTINUE OLD GAME
14100 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
14160 A$ = LEFT$ (A$,1): IF 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
14210 D = 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
14490 A(I) = INT (A * 100 + .5) / 100: NEXT
14500 PRINT : PRINT CHR$ (7): INPUT "...READY TO BEGIN? ";A$
14510 IF LEFT$ (A$,1) = "N" THEN 13000
14520 RETURN
15000 REM WEATHER DISPLAY
15100 CLS
15170 PRINT "LEMONSVILLE WEATHER REPORT:"
15180 IF SC = 2 THEN PRINT " SUNNY"
15190 IF SC = 7 THEN PRINT " HOT AND DRY"
15200 IF SC = 10 THEN PRINT " CLOUDY"
15300 IF SC = 5 THEN PRINT " THUNDERSTORMS!"
15400 PRINT
18000 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 CLS : PRINT "WOULD YOU LIKE TO PLAY AGAIN? ";
31112 GET IN$: IF IN$ = "Y" THEN 150
31114 CLS : END
RUN