Lemonade

Type
Education
Category
Business simulation for children
Author
Bob Polaro (article by Gigi Bisson)
Published in
Antic, October 1985 (Vol. 4, No. 6), bonus game
Year
1985
Language
Atari BASIC
Requirements
Any Atari 8-bit computer, any memory size, Atari BASIC; disk or cassette
Lemonade in GRAPHICS 1 large text: DAY 1, ASSETS $2.00, COST/GLASS .08, LEMON SHORTAGE, and the prompt NO. OF GLASSES

About the program

Running a lemonade stand is one of the oldest computer simulations used in schools. Antic reprinted Bob Polaro's Atari version as its October 1985 bonus game, noting that it "used to be available in the old Atari Program Exchange catalog" and recommending it for ages 8 to 12. The magazine said Polaro had written so much software while a programmer at Atari that people called him "Bob Co.". By 1985 that was the name of his own educational software business in Santa Cruz, California.

You start with $2.00. Every day you decide how many glasses to make, how many advertising signs to put up and what to charge. Then the day plays out. Costs rise with inflation. A Teamsters strike pushes up the price of lemons, but also what people will pay. Roadwork can block your customers completely, a heatwave doubles demand, and a rainstorm can wash out a day's takings. As in real business, you only find out after you've spent the money. Gigi Bisson's article compared it to a down-to-earth M.U.L.E.

Typing it in

The screen labels are inverse-video text in GRAPHICS 1 (GRAPHICS 17). {inv} … {/inv} means press the Atari (inverse) key before and after, and lower-case letters inside inverse text show up as a different colour. There are no other special characters. Antic printed TYPO II checksums beside each line of the magazine listing. They are not part of the program.

How to play

  1. Read the day's conditions, then type the number of glasses to make, always as two digits (up to 99, so type 05 for five).
  2. Type the number of signs (0–9). Their price is shown, for example "SIGNS @ 15 CENTS".
  3. Type your price per glass in cents (up to 99).
  4. Answer Y if you're happy, or N to change your figures.
  5. The program works out sales, income, expenses and profit. Keep going and become a tycoon. If you go bankrupt, press START to try again.

How it works

The sales model (lines 490–530) is short and worth reading. Up to 12 cents a glass, demand grows as the price falls. Above 12 cents it falls off with the square of the price (12^2*S2/P(4)^2), so greed is punished fast. Advertising multiplies demand by a factor based on 1-EXP(-signs*C9): the first few signs help a lot and later ones less and less. The weather factor R is multiplied in (0 for roadwork, 0.5 for possible rain, 2 for a heatwave), with ±5% randomness. You can never sell more glasses than you made (lines 540–570).

Input is read key by key from the keyboard (OPEN #1,4,0,"K:") and echoed in large text, which is why numbers must be typed at a fixed width.

Listing

5 REM LEMONADE
10 REM BY BOB POLARO
12 REM ANTIC PUBLISHING
15 OPEN #1,4,0,"K:":OPEN #3,4,0,"S:":GOTO 40
20 FOR Z9=1 TO 10:NEXT Z9:SOUND 2,0,0,0:RETURN
30 POSITION 0,11:? #6;B$;B$;:POSITION 0,11:RETURN
40 DIM I$(5),X$(20),P(8),B$(20)
50 GRAPHICS 17
60 B$="                    ":GOTO 110
70 SETCOLOR 4,0,0:SOUND 3,100,80,10:FOR Z9=1 TO 20:NEXT Z9:SOUND 3,0,0,0:RETURN
80 RESTORE 90:POSITION 1,13:? #6;"{inv}******************{/inv}":FOR I=1 TO 8:READ X$:PRINT #6;" ";X$:NEXT I:RETURN
90 DATA signs,made,sold,price,income,expenses,profit,assets
100 AS=INT(H*XS+H4):RETURN
110 S2=30:P(8)=2:S3=0.15:H=100:H4=0.5:C=2
120 PRINT #6;"     lemonade"
130 D=D+1
140 FOR I=5 TO 7:POSITION 0,I:PRINT #6;B$;:NEXT I
150 POSITION 0,2:P(3)=0:? #6;" {inv}DAY{/inv} ";D
160 O8=P(8):GOSUB 700
170 ? #6;" {inv}ASSETS    ={/inv}$";X$;"   "
180 C3=0:X$="":GOSUB 760:IF RN>5 THEN 220
190 RESTORE 200:FOR I=1 TO RN:READ X$,C3:NEXT I
200 DATA teamsters strike,4,lemon shortage,6
210 DATA prices down,-4,supply increase,-4,i n f l a t i o n,2
220 C=C+C3:IF C<2 THEN C=2
230 C1=C*0.01
240 POSITION 0,4:? #6;" {inv}COST/GLASS={/inv}";:I$=STR$(C/100):IF LEN(I$)<4 THEN I$(4,4)="0"
250 ? #6;I$(2,4):R=1:P(4)=0:P(1)=0:IF X$<>"" THEN ? #6;" ";X$
260 GOSUB 760:RR=RN
270 IF RN=1 THEN ? #6;" {inv}a chance of rain{/inv}":R=0.5
280 IF RN=2 THEN ? #6;" {inv}roadwork today{/inv}":R=0:SOUND 3,100,60,100
290 IF RN=3 THEN ? #6;" {inv}h e a t  w a v e{/inv}":R=2
300 POSITION 0,8:? #6;" {inv}NO. OF GLASSES{/inv} --":X=16:Y=8:L=2:MO=18:GOSUB 740:? #6;" ":SOUND 3,0,0,0:IF BAD=1 THEN 300
310 IF I0>99 THEN 300
320 XS=I0*C1:GOSUB 100:X1=AS:XS=P(8):GOSUB 100
330 IF X1<=AS THEN 350
340 GOSUB 690:GOTO 300
350 P(2)=I0:GOSUB 760:IF NO=0 THEN S3=(RN+7)*0.01
360 POSITION 0,9:? #6;" {inv}SIGNS @ {/inv}";S3*100;" {inv}CENTS{/inv} - ":X=17+LEN(STR$(S3*100))-1:Y=9:L=1:M0=19:GOSUB 740
365 IF BAD THEN 360
370 IF I0>9 THEN 360
380 O8=P(8)-P(2)*C1:XS=I0*S3:GOSUB 100:X1=AS:XS=O8:GOSUB 100:IF X1<=AS THEN 400
390 GOSUB 690:GOTO 360
400 P(1)=I0
410 POSITION 1,10:? #6;"{inv}PRICE/GLASS{/inv} --":X=13:Y=10:L=2:M0=20:GOSUB 740:? #6;" ":IF BAD THEN 410
420 P(4)=I0:M7=0
430 GOSUB 30:? #6;" {inv}okay{/inv}?({inv}y/n{/inv})-";:X=11:Y=11:L=1:GOSUB 770:IF I$="" THEN 430
440 NO=0:IF I$(1,1)="N" THEN NO=1:GO TO 300
450 IF I$(1,1)<>"Y" THEN 430
460 GOSUB 30:GOSUB 760:IF RN>5 THEN 490
470 IF RR=1 THEN ? #6;" {inv}s t o r m !!{/inv}":FOR I=1 TO 40:SETCOLOR 4,0,12:GOSUB 70:NEXT I:P(3)=0:GOSUB 30:GOTO 540
480 IF RR=2 THEN GOSUB 30:? #6;" {inv}workers buy it all{/inv}":? #6;" {inv}at lunch{/inv}!!":P(3)=P(2):GOTO 540
490 IF P(4)>12 THEN 510
500 N1=(12-P(4))/12*0.8*S2+S2:GO TO 520
510 N1=(12^2*S2/P(4)^2)
520 N2=R*(N1+N1*(1-EXP(-P(1)*C9)*C2))
530 GOSUB 760:P(3)=INT(N2*(0.95+RN*0.1))
540 XS=P(3):GOSUB 100:X1=AS
550 XS=P(2):GOSUB 100
560 IF X1<=AS THEN 580
570 P(3)=P(2)
580 P(5)=P(3)*P(4)*0.01:P(6)=P(1)*S3+P(2)*C1
590 P(7)=P(5)-P(6):P(8)=P(8)+P(7)
600 GOSUB 80
610 FOR F=1 TO 8:O8=P(F):IF F=4 THEN O8=O8/100
620 GOSUB 670:NEXT F
630 IF P(8)>=C1 THEN 130
640 GOSUB 30:? #6;" {inv}bankrupt{/inv}!!":GOSUB 730
650 GOSUB 30:? #6;" PRESS start BUTTON":GOSUB 770
660 GOTO 660
670 X$=STR$(O8):SG=0:IF F>3 THEN GOSUB 700:IF O8<0 THEN SG=-1
680 POSITION 10,F+13:? #6;"        ":POSITION 11+SG,F+13:? #6;X$:RETURN
690 GOSUB 30:PRINT #6;" {inv}not enough assets{/inv}":GOSUB 730:GOSUB 30:RETURN
700 I$="":IF O8*10=INT(O8*10) THEN I$="0"
710 IF O8=INT(O8) THEN I$=".00"
720 X$=STR$(O8):X$(LEN(X$)+1)=I$:RETURN
730 SOUND 2,29,2,7:FOR Z=1 TO 200:NEXT Z:GOTO 20
740 BAD=0:GOSUB 770:X$=I$:TRAP 750:I0=VAL(X$):RETURN
750 BAD=1:RETURN
760 RN=INT(RND(0)*10)+1:RETURN
770 O=0:I$="":SOUND 2,100,100,100:GOSUB 20
780 IF PEEK(53279)=6 THEN RUN
790 IF L=20 AND PEEK(764)=255 THEN 780
800 POSITION X+O,Y:GET #3,J
810 POSITION X+O,Y:? #6;CHR$(J):IF PEEK(764)=255 THEN POSITION X+O,Y:? #6;" "
820 IF PEEK(53279)=6 THEN RUN
830 IF PEEK(764)=255 THEN 810
840 POSITION X+O,Y:GET #1,XX:POKE 764,255:IF XX=155 OR XX=126 THEN RETURN
850 O=O+1:I$(LEN(I$)+1)=CHR$(XX):PRINT #6;CHR$(XX);:IF O=L THEN L=20:RETURN
860 GOTO 800

Download

The original program from the Antic disk, to LOAD or ENTER instead of typing it: LEMONADE.BAS.

Credits