10 PRINT "ITTY BITTY FLASHCARD PROGRAM"
20 REM COPYRIGHT (C) 1981 T.PITTMAN
30 PRINT
40 LET V=0
50 LET Q=0
60 LET G=0
70 LET K=0
80 PRINT "LEVEL OF DIFFICULTY";
90 INPUT L
100 X=RND(2)
110 LET E=0
120 LET C=0
130 IF L>0 THEN IF L<15 THEN GOTO L*200
140 PRINT "PLEASE CHOOSE FROM 1 TO 14"
150 GOTO 80
190 REM         SET UP PROBLEM
200 GOSUB 2950
210 LET H=9
220 IF L<5 THEN LET F=L/2*2+2-L
230 LET D=-1
240 LET M=R-1
250 LET N=R+1
260 GOTO 3010
400 GOSUB 2950
410 LET A=R
420 LET R=A-B
430 GOTO 210
600 LET A=RND(9)+1
610 LET B=RND(9)+1
620 LET R=A+B
630 LET H=19
640 GOTO 220
800 LET B=RND(9)+1
810 LET R=RND(9)+1
820 LET A=R+B
830 GOTO 210
1000 LET F=RND(8)/4+1
1010 GOTO (F+L)*200-600
1200 GOSUB 2950
1210 LET X=A*10
1220 LET Y=B*10
1230 GOSUB 2950
1240 LET A=A+X
1250 LET B=B+Y
1260 LET R=A+B
1270 LET D=-1
1280 LET H=99
1290 LET M=-1
1300 LET N=-1
1310 IF L<10 THEN LET F=L-L/2*2+1
1320 GOTO 3010
1400 GOSUB 2950
1410 LET X=R*10
1420 LET Y=B*10
1430 GOSUB 2950
1440 LET A=R+X
1450 LET B=B+Y
1460 LET R=A-B
1470 GOTO 1270
1600 GOSUB 2950
1610 LET R=R*10+RND(10)
1620 A=RND(R-1)+1
1630 LET B=R-A
1640 LET D=R+10-(A-A/10*10+B-B/10*10)/10*20
1650 GOTO 1280
1800 GOSUB 2950
1810 LET A=R*10+RND(10)
1820 LET B=RND(A-1)+1
1830 LET R=A-B
1840 LET D=R+10-(A-A/10*10-B+B/10*10+10)/10*20
1850 GOTO 1280
2000 GOTO 1000
2200 LET A=RND(9)+1
2210 LET B=RND(9)+1
2220 LET R=A*B
2230 LET M=R/10*10+A
2240 LET N=R/10*10+B
2250 IF M=R THEN LET M=R-10
2260 IF N=R THEN LET N=R+10
2270 LET F=3
2280 LET H=99
2290 LET D=-1
2300 GOTO 3010
2400 LET R=RND(9)+1
2410 LET B=RND(9)+1
2420 LET A=R*B
2430 LET M=R+1
2440 LET N=R-1
2450 LET F=4
2460 LET D=-1
2470 LET H=9
2480 GOTO 3010
2600 GOSUB 2950
2610 LET R=R*10+RND(10)
2620 LET B=9-RND(25)/3
2630 LET A=R/B
2640 LET R=A*B
2650 LET D=R-(A-A/10*10)*B/10*10
2660 LET M=R+10
2670 LET N=D-10
2680 IF R-D>10 THEN LET M=R-10
2690 IF R-D>20 THEN LET N=D+10
2700 LET F=3
2710 LET H=99
2720 GOTO 3010
2800 LET F=RND(8)/2+1
2810 GOTO F*200+1400+F/3*(1800-F*400)
2900 REM        SELECT 1-DIGIT SUM, NO CARRY
2910 REM DISTRIBUTION OF RESULT (IN 81 CASES):
2920 REM 2-1 3-2 4-5 5-7 6-9 7-14 8-19 9-25
2950 LET R=9-(RND(9)+1)*(RND(9)+1)/11
2960 LET A=RND(R-1)+1
2970 LET B=R-A
2980 RETURN
3000 REM        DISPLAY PROBLEM & ACCEPT ANSWER
3010 LET T=0
3020 IF V>0 THEN GOTO 3100
3030 LET X=A
3040 GOSUB 3510
3050 GOSUB 3610
3060 LET X=B
3070 GOSUB 3520
3080 PRINT "----"
3090 GOTO 3130
3100 PRINT A;" ";
3110 GOSUB 3610
3120 PRINT B;" =";
3130 INPUT X
3140 LET T=T+1
3150 IF X#R THEN GOTO 3210
3160 LET C=C+1
3170 IF T>1 THEN GOTO RND(4)*20+4000
3180 LET K=K+1
3190 GOTO RND(5)*20+4100
3200 REM        IDENTIFY ERROR TYPE
3210 LET E=E+1
3220 IF X<0 THEN GOTO RND(3)*20+4200
3230 IF X>H THEN GOTO RND(4)*20+4200
3240 IF X=D THEN GOTO RND(3)*20+4300
3250 IF X=M THEN GOTO RND(4)*20+4400
3260 IF X=N THEN GOTO RND(4)*20+4400
3270 IF R>9 THEN IF X>9 THEN GOTO 3710
3280 GOSUB RND(5)*20+4500
3300 REM        ADVANCE TO NEXT TRY
3310 IF T<3 THEN GOTO 3020
3320 GOSUB RND(3)*20+3900
3330 PRINT "THE ANSWER IS ";R
3340 LET G=G+1
3350 PRINT
3360 IF G>G/10*10 THEN GOTO L*200
3370 PRINT "YOU GOT ";C;" ANSWERS CORRECT"
3380 IF E>0 THEN PRINT "BUT GAVE ";E;" WRONG ANSWERS."
3390 IF G=10 THEN GOTO 3450
3410 PRINT "IN THE LAST ";G;" LEVEL ";L;" PROBLEMS,"
3420 PRINT "YOU GOT ";K;" ANSWERS PERFECT."
3430 IF K*100/G<Q THEN GOSUB RND(2)*20+4800
3440 IF K*100/G>Q THEN GOSUB RND(3)*20+4900
3450 LET Q=K*100/G
3460 PRINT "LET'S GO AGAIN."
3470 GOTO 110
3500 REM        PRINT ONE NUMBER ON A LINE
3510 PRINT "  ";
3520 IF X<10 THEN PRINT " ";
3530 PRINT X
3540 RETURN
3600 REM        PRINT OPERATION SYMBOL
3610 IF F=1 THEN PRINT "+ ";
3620 IF F=2 THEN PRINT "- ";
3630 IF F=3 THEN PRINT "X ";
3640 IF F=4 THEN PRINT "/ ";
3650 RETURN
3700 REM        TRY FOR 2-DIGIT ERRORS
3710 IF R/10+(R-R/10*10)*10=X THEN GOTO RND(3)*20+4700
3720 IF R/10=X/10 THEN GOTO RND(2)*20+4600
3730 IF R-R/10*10=X-X/10*10 THEN GOTO RND(2)*20+4600
3740 GOTO 3280
3800 REM        SELECTED QWIPS
3900 PRINT "LET'S FACE IT: YOU'RE NOT GOING TO GET THIS ONE."
3910 RETURN
3920 PRINT "THIS ONE IS TOO HARD FOR YOU, EH?"
3930 RETURN
3940 PRINT "LET'S NOT WASTE ANY MORE TIME ON THIS ONE."
3950 RETURN
4000 PRINT "NOT BAD FOR ";T;" TRIES."
4010 GOTO 3340
4020 PRINT "WELL, IT'S ABOUT TIME YOU GOT IT RIGHT."
4030 GOTO 3340
4040 PRINT "WHEW! I THOUGHT FOR A MINUTE IT WAS TOO HARD."
4050 GOTO 3340
4060 PRINT "DO YOU ALWAYS WAIT SO LONG TO GET IT RIGHT?"
4070 GOTO 3340
4100 PRINT "FANTASTIC! YOU GOT IT THE FIRST TRY."
4110 GOTO 3340
4120 PRINT "WE OUGHT TO DO THIS MORE OFTEN."
4130 GOTO 3340
4140 PRINT "GREAT! DO YOU GET BROWNIE POINTS FOR NO MISTAKES?"
4150 GOTO 3340
4160 IF C<E THEN PRINT "YOU'RE GETTING BETTER."
4170 IF C>E THEN PRINT "HEY, YOU'RE SHARP TODAY!"
4180 PRINT "RIGHT ON!"
4190 GOTO 3340
4200 PRINT "AW, C'MON, THAT'S NO ANSWER!"
4210 GOTO 3310
4220 PRINT "YOU'RE SUPPOSED TO TYPE A NUMBER FROM 1 TO ";H
4230 GOTO 3310
4240 PRINT "WHAT A SILLY ANSWER! NOW STOP PLAYING."
4250 GOTO 3310
4260 PRINT "THAT'S WAY TOO BIG. TRY AGAIN."
4270 GOTO 3310
4300 PRINT "YOU MISSED THE";
4310 GOTO 4370
4320 PRINT "WATCH OUT FOR THE";
4330 GOTO 4370
4340 PRINT "ALMOST RIGHT, EXCEPT FOR THE";
4370 IF F=2 THEN PRINT " BORROW."
4380 IF F#2 THEN PRINT " CARRY."
4390 GOTO 3310
4400 PRINT "YOU'RE GETTING WARM!"
4410 GOTO 3310
4420 PRINT "CLOSE, BUT NO CIGAR."
4430 GOTO 3310
4440 PRINT "NOT BAD, BUT NOT GOOD EITHER."
4450 GOTO 3310
4460 PRINT "ALMOST ONLY COUNTS IN HORSESHOES AND HAND GRENADES."
4470 GOTO 3310
4500 PRINT "AW, YOU'RE JUST GUESSING."
4510 RETURN
4520 PRINT "YOU'RE NOT TRYING AT ALL."
4530 RETURN
4540 PRINT "YOU CAN DO BETTER THAN THAT!"
4550 RETURN
4560 PRINT "THAT'S NOT EVEN CLOSE!"
4570 RETURN
4580 PRINT "THINK A LITTLE HARDER."
4590 RETURN
4600 PRINT "ONE DIGIT RIGHT IS BETTER THAN NONE."
4610 GOTO 3310
4620 PRINT "THAT'S ONLY HALF RIGHT."
4630 GOTO 3310
4700 PRINT "YOU AREN'T CROSSEYED, ARE YOU?"
4710 GOTO 3310
4720 PRINT "RIGHT NUMERALS, WRONG PLACES."
4730 GOTO 3310
4740 PRINT "NO, THAT'S BACKWARDS."
4750 GOTO 3310
4800 PRINT "YOU MUST BE GETTING TIRED."
4810 RETURN
4820 PRINT "THAT'S NOT SO GOOD."
4830 RETURN
4900 PRINT "HEY, YOU'RE GETTING BETTER!"
4910 RETURN
4920 PRINT "GOOD GOING! I'M PROUD OF YOU!"
4930 RETURN
4940 PRINT "KEEP THAT UP, AND WE CAN GRADUATE TO THE NEXT LEVEL."
4950 RETURN
5000 END