10 OPEN "I",#1,"tdata"
20 INPUT#1,SV1$,SV2$,SV3$,SV4$,SV5$,SV6$
30 CLOSE#1
40 CLS
50 LOCATE 5,8:PRINT"File of saved programs:"
60 LOCATE 8,8:PRINT"1. "SV1$
70 LOCATE 10,8:PRINT"2. "SV2$
80 LOCATE 12,8:PRINT"3. "SV3$
90 LOCATE 14,8:PRINT"4. "SV4$
100 LOCATE 16,8:PRINT"5. "SV5$
110 LOCATE 18,8:PRINT"6. "SV6$
120 LOCATE 21,8,1:PRINT"Which file do you want? ";
130 E$=INPUT$(1)
140 IF E$=CHR$(27) GOTO 8480
150 IF E$<"1" OR E$>"6" GOTO 130
160 PRINT E$
170 S$="SAV"+E$
180 CLS
190 LOCATE 13,11,0:PRINT"One moment, please!"
200 OPEN "I",#1,S$
210 INPUT#1,GRD,FORM$,TYP$,TLIMIT$,BNDA,BNDB,BNDC,BNDD,BNDE,TEST,BASE,SEL
220 CLOSE#1
230 CLS
240 LOCATE 13,1:INPUT "What is your name? ",MICK$
250 IF GRD>0 GOTO 330
260 CLS
270 LOCATE 13,1:PRINT "What grade are you in "MICK$"? "
280 E$=INPUT$(1)
290 IF E$=CHR$(27) GOTO 8480
300 IF E$<"1" OR E$>"6" GOTO 280
310 GRD=VAL(E$)
320 ON GRD GOSUB 8510,8540,8570,8600,8630,8660
330 PROB=1
340 AFORM$=FORM$
350 ATYP$=TYP$
360 RANDOMIZE(BASE)
370 BFORM$=LEFT$(AFORM$,1)
380 AFORM$=RIGHT$(AFORM$,9)+BFORM$
390 FORMAT=VAL(BFORM$)
400 BTYP$=LEFT$(ATYP$,1)
410 ATYP$=RIGHT$(ATYP$,9)+BTYP$
420 TYPE=VAL(BTYP$)
430 TIME$="00:00:00"
440 ON FORMAT GOTO 720,750,790,820,850
450 IF Y$<>Z$ GOTO 670
460 TLAPSE$=TIME$
470 IF TLIMIT$TEST GOTO 560
540 PRINT "Test is over!  Press ";CHR$(17);CHR$(196);CHR$(217);" for score.";
550 GOTO 570
560 LOCATE 23,1:PRINT"For next problem, press ";CHR$(17);CHR$(196);CHR$(217);" ";
570 E$=INPUT$(1)
580 IF E$=CHR$(27) GOTO 7940
590 IF E$<>CHR$(13) GOTO 570
600 IF PROB=TEST GOTO 7940
610 PROB=PROB+1
620 IF MPROB=PROB-1 THEN RETURN
630 W$=""
640 IF MPROB<>0 GOTO 370
650 CLS
660 GOTO 370
670 LOCATE 21,1:PRINT"Wrong! Answer is ";Z$
680 SOUND 45,25
690 M$=STR$(PROB)
700 MM$=MM$+M$
710 GOTO 510
720 BND=BNDA+1
730 IF GRD>4 THEN L=1 ELSE L=0
740 ON TYPE GOTO 1390,1390,1390,2940
750 BND=BNDB+1
760 IF GRD>4 THEN L=1 ELSE L=0
770 ON GRD GOTO 2610,2610,1410,780,780,780
780 IF TYPE=4 GOTO 2940 ELSE GOTO 1410
790 BND=BNDC+1
800 IF GRD=4 THEN L=1 ELSE L=0
810 ON GRD GOTO 1390,1390,2960,1410,4630,4630
820 BND=BNDD+1
830 IF GRD=3 THEN L=1 ELSE L=0
840 ON GRD GOTO 1390,1410,1410,4630,4630,4630
850 BND=BNDE+1
860 L=0
870 ON GRD GOTO 6930,6930,6930,4630,4630,4630
880 FOR I=1 TO QTY
890 DB$(I)=""
900 AB$(I)=STR$(B(I))
910 BB(I)=LEN(AB$(I))-1
920 CB$(I)=RIGHT$(AB$(I),BB(I))
930 FOR H=1 TO BB(I)
940 J$=RIGHT$(CB$(I),1)
950 CB$(I)=J$+LEFT$(CB$(I),BB(I)-1)
960 DB$(I)=" "+J$+DB$(I)
970 EB(I)=LEN(DB$(I))
980 NEXT H
990 NEXT I
1000 IF L=0 GOTO 1220
1010 IF GRD<6 THEN DCML=GRD-1
1020 FOR I=1 TO QTY
1030 ON TYPE GOTO 1040,1040,1050,1050
1040 IF I>1 GOTO 1080
1050 AA=1000*RND(PROB)
1060 IF GRD=6 THEN AC=AA MOD BB(I)+1 ELSE AC=AA MOD DCML
1070 IF AC=0 GOTO 1050
1080 C(I)=AC
1090 IF BB(I)=>C(I) GOTO 1130
1100 FOR H=1 TO C(I)-BB(I)
1110 DB$(I)=" 0"+DB$(I)
1120 NEXT H
1130 EB(I)=LEN(DB$(I))
1140 MID$(DB$(I),EB(I)-2*C(I)+1)="."
1150 NEXT I
1160 ON TYPE GOTO 1170,1170,1190,1210
1170 L=C(1)
1180 GOTO 1220
1190 L=C(1)+C(2)
1200 GOTO 1220
1210 L=C(1)-C(2)
1220 W$=STR$(A)
1230 WW=LEN(W$)-1
1240 W$=RIGHT$(W$,WW)
1250 IF L=0 GOTO 1340
1300 W$=W$+"0"
1310 WW=WW+1
1320 L=L+1
1330 GOTO 1290
1340 IF L=0 GOTO 1360
1350 W$=LEFT$(W$,WW-L)+"."+RIGHT$(W$,L)
1360 Z$=W$
1370 CC$=STRING$(EB(1),"?")
1380 RETURN
1390 ON FORMAT GOSUB 7540,7540,7590,7920
1400 GOTO 1420
1410 ON TYPE GOSUB 7540,7540,7540
1420 GOSUB 880
1430 IF MPROB>PROB GOTO 610
1440 CLS
1450 PRINT TAB(7) "OK " MICK$", here is problem "PROB
1460 IF FORMAT<>3 GOTO 1480
1470 LOCATE 3,21+BB(1)-EB(3):PRINT USING "&";DB$(3)
1480 LOCATE 5,21+BB(1)-EB(1):PRINT USING "&";DB$(1)
1490 LOCATE 7,20+BB(1)-EB(1):PRINT OP$;
1500 LOCATE 7,21+BB(1)-EB(2):PRINT USING "&";DB$(2)
1510 PRINT SPC(20+BB(1)-EB(1)) CC$
1520 IF RE=1 GOTO 560
1530 LOCATE 23,1,1:PRINT "To correct an entry, press c"
1540 YAX=9
1550 XAX=20+BB(1)
1560 ON TYPE GOTO 1900,1900,1570
1570 IF BB(2)=1 THEN TYPE=1
1580 IF BB(2)=1 GOTO 1900
1590 FOR H=1 TO BB(2)
1600 FB$=MID$(AB$(2),BB(2)-H+2,1)
1610 GB=VAL(FB$)
1620 ANS=GB*B(1)
1630 AANS$=STR$(ANS)
1640 BANS=LEN(AANS$)-1
1650 IF GB=0 THEN BANS=BB(1)
1660 FOR G=1 TO BANS
1670 LOCATE YAX,XAX,1
1680 E$=INPUT$(1)
1690 IF E$<>"c" AND E$<>"C" GOTO 1770
1700 IF G=1 GOTO 1540
1710 IF BANS=BB(1) GOTO 1740
1720 IF G=BANS-1 THEN XAX=XAX+2
1730 IF G=BANS THEN XAX=XAX-4
1740 XAX=XAX+2
1750 G=G-1
1760 GOTO 1670
1770 IF E$<"0" OR E$>"9" GOTO 1680
1780 PRINT E$
1790 IF BANS=BB(1) GOTO 1820
1800 IF G=BANS-2 THEN XAX=XAX-2
1810 IF G=BANS-1 THEN XAX=XAX+4
1820 XAX=XAX-2
1830 NEXT G
1840 IF BANS=BB(1) THEN XAX=XAX+(2*BANS-2) ELSE IF BANS=1 THEN XAX=XAX ELSE XAX=XAX+(2*BANS-4)
1850 CC$=STRING$(2*WW-1,"?")
1860 IF H=BB(2) THEN PRINT SPC(21+BB(1)-2*WW)CC$
1870 YAX=YAX+2
1880 NEXT H
1890 XAX=20+BB(1)
1900 W$=STR$(A)
1910 WW=LEN(W$)-1
1920 IF BB(1)=1 AND WW=2 THEN XAX=XAX-2
1930 FOR I=1 TO WW
1940 LOCATE YAX,XAX,1
1950 Q$(I)=INPUT$(1)
1960 IF Q$(I)<>"c" AND Q$(I)<>"C" GOTO 2060
1970 IF I=1 GOTO 1540
1980 ON TYPE GOTO 1990,2030,2000
1990 IF WW>BB(1) GOTO 2010 ELSE GOTO 2030
2000 IF BANS+BB(2)-1"9" GOTO 1940
2070 PRINT Q$(I)
2080 ON TYPE GOTO 2090,2130,2100
2090 IF WW>BB(1) GOTO 2110 ELSE GOTO 2130
2100 IF BANS+BB(2)-1"8" GOTO 2200
2230 PRINT E$
2240 HV=VAL(E$)
2250 XAX=21+BB(1)
2260 ON TYPE GOTO 2270,2300,2290
2270 IF WW>BB(1) THEN SWAP Q$(WW),Q$(WW-1)
2280 GOTO 2300
2290 IF BANS+BB(2)-1HV OR L=0 GOTO 2380
2350 Y$="."+Y$
2360 LOCATE YAX,XAX
2370 PRINT "."
2380 NEXT I
2390 IF WW=>HV GOTO 2480
2400 XAX=XAX+1
2410 FOR I=WW+1 TO HV+1
2420 IF I=HV+1 THEN XAX=XAX-1 ELSE XAX=XAX-2
2430 IF I=HV+1 THEN Q$(I)="." ELSE Q$(I)="0"
2440 LOCATE YAX,XAX
2450 PRINT Q$(I)
2460 Y$=Q$(I)+Y$
2470 NEXT I
2480 LOCATE 21,1:PRINT "Press ";CHR$(17);CHR$(196);CHR$(217);" ";
2490 E$=INPUT$(1)
2500 IF E$<>"c" AND E$<>"C" GOTO 2590
2510 XAX=19+BB(1)
2520 FOR I=1 TO 9
2530 Q$(I)=" "
2540 LOCATE YAX,XAX,0
2550 PRINT Q$(I)
2560 IF I=WW OR I=HV AND HV>WW THEN XAX=XAX-1 ELSE XAX=XAX-2
2570 NEXT I
2580 GOTO 1540
2590 IF E$<>CHR$(13) GOTO 2490
2600 GOTO 450
2610 ON FORMAT GOSUB 7540,7540,7590,7920
2620 GOSUB 880
2630 IF MPROB>PROB GOTO 610
2640 CLS
2650 PRINT TAB(7) "OK " MICK$", here is problem "PROB
2660 LOCATE 10,18-EB(1)-EB(2):PRINT USING "&";DB$(1);
2670 PRINT USING " &";OP$;
2680 PRINT USING "& _=";DB$(2)
2690 IF RE=1 GOTO 560
2700 LOCATE 23,1,1:PRINT "To correct an entry, press c"
2710 XAX=23
2720 YAX=10
2730 FOR I=1 TO WW
2740 LOCATE YAX,XAX
2750 Q$(I)=INPUT$(1)
2760 IF Q$(I)<>"c" AND Q$(I)<>"C" GOTO 2810
2770 IF I=1 GOTO 2740
2780 XAX=XAX-2
2790 I=I-1
2800 GOTO 2740
2810 IF Q$(I)<"0" OR Q$(I)>"9" GOTO 2750
2820 PRINT Q$(I)
2830 XAX=XAX+2
2840 NEXT I
2850 LOCATE 21,1:PRINT "Press ";CHR$(17);CHR$(196);CHR$(217)" ";
2860 E$=INPUT$(1)
2870 IF E$="c" OR E$="C" GOTO 2710
2880 IF E$<>CHR$(13) GOTO 2860
2890 Y$=""
2900 FOR I=1 TO WW
2910 Y$=Y$+Q$(I)
2920 NEXT I
2930 GOTO 450
2940 ON FORMAT GOSUB 7540,7540,7590,7920
2950 GOTO 2970
2960 GOSUB 7540
2970 GOSUB 880
2980 IF MPROB>PROB GOTO 610
2990 CLS
3000 PRINT TAB(7) "OK " MICK$", here is problem "PROB
3010 LOCATE 4,18:PRINT USING "&";"?";CC$
3020 LOCATE 5,17-EB(2):PRINT USING "&";DB$(2);
3030 PRINT " ";
3040 PRINT USING "&";"?";
3050 PRINT USING "&";DB$(1)
3060 IF RE=1 GOTO 560
3070 LOCATE 23,1,1:PRINT "To correct an entry, press c"
3080 IF GRD<5 THEN GOTO 3360
3090 LOCATE 10,1:PRINT "Move decimals   spaces to the right?"
3100 LOCATE 10,15,1
3110 E$=INPUT$(1)
3120 IF E$<"0" OR E$>"9" GOTO 3110
3130 HH=VAL(E$)
3140 IF HH>C(2) GOTO 3110
3150 LOCATE 10,1:PRINT STRING$(36," ")
3160 IF E$="0" GOTO 3270
3170 MID$(DB$(2),EB(2)-2*C(2)+1)=" "
3180 IF C(2)=HH GOTO 3200
3190 MID$(DB$(2),EB(2)-2*(C(2)-HH)+1)="."
3200 MID$(DB$(1),EB(1)-2*C(1)+1)=" "
3210 IF C(1)=HH GOTO 3280 ELSE IF C(1)>HH GOTO 3270
3220 FOR I=1 TO HH-C(1)
3230 DB$(1)=DB$(1)+" 0"
3240 B(1)=VAL(DB$(1))
3250 NEXT I
3260 GOTO 3280
3270 MID$(DB$(1),EB(1)-2*(C(1)-HH)+1)="."
3280 EB(1)=LEN(DB$(1))
3290 CC$=STRING$(EB(1),"?")
3300 LOCATE 4,19:PRINT USING "&";CC$
3310 LOCATE 5,17-EB(2):PRINT USING "&";DB$(2)
3320 LOCATE 5,19:PRINT USING "&";DB$(1)
3330 LOCATE 3,19+EB(1)-2*(C(1)-HH),0
3340 IF HHWW GOTO 3390
3360 XAX=20+EB(1)-2*WW
3370 WWW=WW
3380 GOTO 3410
3390 XAX=20+EB(1)-2*(C(1)-HH)
3400 WWW=C(1)-HH
3410 YAX=3
3420 DIV=B(1)
3430 II=0:Y$=""
3440 FOR I=1 TO WWW
3450 LOCATE YAX,XAX,1
3460 Q$(I)=INPUT$(1)
3470 IF I=1 AND Q$(I)="c" OR Q$(I)="C" GOTO 4510 ELSE IF Q$(I)="c" OR Q$(I)="C" GOTO 3350
3480 IF Q$(I)<"0" OR Q$(I)>"9" GOTO 3460
3490 PRINT Q$(I)
3500 Y$=Q$(I)+Y$
3510 YY=VAL(Y$)
3520 IF Q$(I)<>"0" GOTO 3580
3530 XAX=XAX+2
3540 II=II+1
3550 IF YY=0 OR I=WWW GOTO 4320
3560 YAX=YAX+4*(I-II)+2
3570 GOTO 4240
3580 YAX=YAX+4*(I-II)
3590 AQ=VAL(Q$(I))
3600 BQ=AQ*B(2)
3610 CQ$=STR$(BQ)
3620 DQ=LEN(CQ$)-1
3630 GOSUB 4440
3640 IF BB(2)=1 AND DQ=2 THEN XAX=XAX-2
3650 FOR H=1 TO DQ
3660 LOCATE YAX,XAX,1
3670 R$(H)=INPUT$(1)
3680 IF R$(H)<>"c" AND R$(H)<>"C" GOTO 3790
3690 IF H<>1 GOTO 3730
3700 IF BB(2)=1 AND DQ=2 THEN XAX=XAX+2
3710 YAX=YAX-4*(I-II)
3720 GOTO 3450
3730 IF DQ=BB(2) GOTO 3760
3740 IF H=DQ THEN XAX=XAX-4
3750 IF H=DQ-1 THEN XAX=XAX+2
3760 XAX=XAX+2
3770 H=H-1
3780 GOTO 3660
3790 IF R$(H)<"0" OR R$>"9" GOTO 3670
3800 PRINT R$(H)
3810 IF DQ=BB(2) GOTO 3840
3820 IF H=DQ-1 THEN XAX=XAX+4
3830 IF H=DQ-2 THEN XAX=XAX-2
3840 XAX=XAX-2
3850 NEXT H
3860 CC$=STRING$(2*DQ-1,"?")
3870 IF DQ=BB(2) THEN PRINT SPC(XAX+1) CC$ ELSE PRINT SPC(XAX-1) CC$
3880 ANS$=""
3890 IF DQ<>BB(2) THEN SWAP R$(DQ),R$(DQ-1)
3900 FOR H=1 TO DQ
3910 ANS$=R$(H)+ANS$
3920 NEXT H
3930 DANS=LEN(ANS$)
3940 ZERO$=STRING$(WW-I,48)
3950 ANS$=ANS$+ZERO$
3960 AANS=VAL(ANS$)
3970 BANS=DIV-AANS
3980 DIV=BANS
3990 CAN$=STR$(BANS)
4000 AN=LEN(CAN$)-1
4010 BN=AN-LEN(ZERO$)
4020 IF DQ=BB(2) THEN XAX=XAX+2*DQ ELSE XAX=XAX+2*DQ-2
4030 YAX=YAX+2:DQ=BN
4040 GOSUB 4440
4050 IF BANS>0 GOTO 4070 ELSE BN=0
4060 GOTO 4220
4070 FOR G=1 TO BN
4080 LOCATE YAX,XAX,1
4090 E$=INPUT$(1)
4100 IF E$<>"c" AND E$<>"C" GOTO 4180
4110 IF G<>1 GOTO 4150
4120 DIV=DIV+AANS
4130 YAX=YAX-2
4140 GOTO 3640
4150 G=G-1
4160 XAX=XAX+2
4170 GOTO 4080
4180 IF E$<"0" OR E$>"9" GOTO 4090
4190 XAX=XAX-2
4200 PRINT E$
4210 NEXT G
4220 IF I=WWW GOTO 4320
4230 XAX=XAX+2*(BN+1)
4240 LOCATE YAX,XAX,1
4250 E$=INPUT$(1)
4260 IF E$<>"c" AND E$<>"C" GOTO 4290
4270 XAX=XAX-2
4280 IF BN>0 GOTO 4070 ELSE GOTO 3350
4290 IF E$<"0" OR E$>"9" GOTO 4250
4300 PRINT E$
4310 YAX=YAX-4*(I-II)-2
4320 NEXT I
4330 LOCATE 21,1,1:PRINT "Press ";CHR$(17);CHR$(196);CHR$(217);" ";
4340 E$=INPUT$(1)
4350 IF E$="c" OR E$="C" GOTO 3350
4360 IF E$<>CHR$(13) GOTO 4340
4370 Y$=""
4380 FOR I=WWW TO 1 STEP -1
4390 Y$=Q$(I)+Y$
4400 IF L=0 GOTO 4420
4410 IF I=WWW-(C(1)-HH)+1 THEN Y$="."+Y$
4420 NEXT I
4430 GOTO 450
4440 XAX=XAX-8
4450 FOR P=5 TO 1 STEP -1
4460 LOCATE YAX,XAX,0
4470 IF P>DQ THEN PRINT " "
4480 IF P>1 THEN XAX=XAX+2
4490 NEXT P
4500 RETURN
4510 IF HH>C(1) GOTO 4550
4520 IF HH=C(1) GOTO 4580
4530 MID$(DB$(1),EB(1)-2*(C(1)-HH)+1)=" "
4540 GOTO 4570
4550 DB$(1)=LEFT$(DB$(1),EB(1)-2*(HH-C(1)))
4560 EB(1)=LEN(DB$(1))
4570 CC$=STRING$(EB(1),"?")
4580 MID$(DB$(1),EB(1)-2*C(1)+1)="."
4590 IF HH=C(2) GOTO 4610
4600 MID$(DB$(2),EB(2)-2*(C(2)-HH)+1)=" "
4610 MID$(DB$(2),EB(2)-2*C(2)+1)="."
4620 GOTO 2990
4630 QTY=6
4640 BND=BND/2
4650 GOSUB 7480
4660 IF MPROB>PROB GOTO 610
4670 FOR I=1 TO QTY-1
4680 IF B(I)<2 GOTO 4760
4690 FOR H=I+1 TO QTY
4700 IF B(H)<2 GOTO 4750
4710 IF B(I)*B(H)>BND*2 GOTO 4750
4720 IF B(I)<>5 THEN SWAP B(I),B(5)
4730 IF B(H)<>6 THEN SWAP B(H),B(6)
4740 GOTO 4770
4750 NEXT H
4760 NEXT I
4770 IF B(5)=1 AND B(6)=1 GOTO 4650
4780 IF B(5)*B(6)>BND*2 OR B(5)=1 GOTO 4810
4790 IF B(6)=1 THEN B(6)=B(5)
4800 GOTO 4870
4810 B(5)=B(6)
4820 IF GRD>4 AND FORMAT=5 GOTO 5070
4830 IF B(5)*B(6)B(I+2) GOTO 4990
4980 B(I)=B(I)-1
4990 IF B(I)2 GOTO 5070
5040 IF B(3)/B(5)>B(4)/B(6) GOTO 5070
5050 B(3)=B(3)+1
5060 GOTO 5040
5070 FOR I=1 TO QTY
5080 AB$(I)=STR$(B(I))
5090 EB(I)=LEN(AB$(I))
5100 NEXT I
5110 FOR I=3 TO 4
5120 IF EB(I)=4 GOTO 5230
5210 QTY=2
5220 GOTO 5240
5230 IF FORMAT=5 THEN QTY=5 ELSE QTY=2
5240 FOR I=1 TO QTY
5250 IF I=4 GOTO 5300
5260 B(I)=0
5270 AB$(I)=""
5280 EB(I)=0
5290 CB$(I)=""
5300 NEXT I
5310 EQ$=" ="
5320 EC$=""
5330 CC$=" "+STRING$(EB(6)-1,"?")
5340 IF EB(5)<>0 GOTO 5400
5350 DC$=""
5360 OP$=""
5370 AN=B(6)
5380 BN=B(4)
5390 GOTO 5520
5400 DC$=" "+STRING$(EB(5)-1,"?")
5410 IF B(2)>0 THEN B(4)=B(2)*B(6)+B(4)
5420 IF B(1)>0 THEN B(3)=B(1)*B(5)+B(3)
5430 IF TYPE=4 THEN SWAP B(4),B(6)
5440 IF B(6)<>B(5) OR TYPE>2 GOTO 5470
5450 AN=B(6)
5460 GOTO 5510
5470 AN=B(6)*B(5)
5480 IF TYPE>2 GOTO 5510
5490 B(4)=B(4)*B(5)
5500 B(3)=B(3)*B(6)
5510 ON TYPE GOSUB 6810,6840,6870,6900
5520 PP=LEN(OP$)
5530 CN=BN MOD AN
5540 DN=BN\AN
5550 IF CN=0 GOTO 5730
5560 FOR H=2 TO CN
5570 EN=AN MOD H
5580 GN=CN MOD H
5590 IF EN+GN>0 GOTO 5630
5600 AN=AN/H
5610 CN=CN/H
5620 GOTO 5550
5630 NEXT H
5640 IF CN=0 GOTO 5730
5650 IF B(4)=B(6) AND B(3)=0 GOTO 5670
5660 IF CN<>B(4) OR AN<>B(6) OR B(3)<>0 GOTO 5730
5670 DN=CINT(100*BN/AN)
5680 DNS$=STR$(DN)
5690 EC$=" %"
5700 Z$=DNS$+EC$
5710 WW=LEN(DNS$)-1
5720 GOTO 5750
5730 IF DN>0 THEN DNS$=STR$(DN) ELSE DNS$=""
5740 IF CN>0 GOTO 5800
5750 CNS$=""
5760 ANS$=""
5770 ANT=0
5780 ANU$=""
5790 GOTO 5840
5800 CNS$=STR$(CN)
5810 ANS$=STR$(AN)
5820 ANT=LEN(ANS$)-1
5830 ANU$="/"+RIGHT$(ANS$,ANT)
5840 IF CNS$<>"" THEN CNT=LEN(CNS$)-1 ELSE CNT=0
5850 DNT=LEN(DNS$)
5860 ANV=LEN(ANU$)
5870 IF B(3)<>0 GOTO 5890
5880 IF EC$=" %" GOTO 5930
5890 Z$=DNS$+CNS$+ANU$
5900 WW=LEN(Z$)-1-ANV
5910 IF Z$="" THEN Z$=" 0"
5920 IF ANV>0 THEN EC$=" "+STRING$(ANV-1,"?") ELSE EC$=""
5930 CLS
5940 PRINT TAB(7) "OK " MICK$", here is problem "PROB
5950 IF GRD=4 AND FORMAT=4 GOTO 6040
5960 IF GRD>4 AND FORMAT=3 GOTO 6040
5970 X=20-EB(1)-EB(5)-PP-EB(2)-EB(6)
5980 LOCATE 7,X:PRINT SPC(EB(1));CB$(3);SPC(PP);SPC(EB(2));CB$(4)
5990 LOCATE 8,X:PRINT AB$(1);DC$;OP$;AB$(2);CC$;EQ$;SPC(DNT);EC$
6000 LOCATE 9,X:PRINT SPC(EB(1));AB$(5);SPC(PP);SPC(EB(2));AB$(6);SPC(2);SPC(DNT);ANS$
6010 IF ANV>0 THEN XAX=21+DNT+ANV ELSE XAX=23
6020 YAX=7
6030 GOTO 6360
6040 EB(7)=ANV
6050 A=0
6060 FOR I=5 TO 7
6070 IF EB(I)>A THEN A=EB(I)
6080 NEXT I
6090 IF A=EB(5) GOTO 6130
6100 CB$(3)=" "+CB$(3)
6110 AB$(5)=" "+AB$(5)
6120 DC$=" "+DC$
6130 IF A=EB(6) GOTO 6170
6140 CB$(4)=" "+CB$(4)
6150 AB$(6)=" "+AB$(6)
6160 CC$=" "+CC$
6170 IF A=EB(7) GOTO 6210
6180 ANT=ANT+1
6190 ANS$=" "+ANS$
6200 EC$=" "+EC$
6210 CB$(2)=SPACE$(EB(1))
6220 RSET CB$(2)=AB$(2)
6230 LOCATE 4,20:PRINT CB$(3)
6240 LOCATE 5,20-EB(1):PRINT AB$(1);DC$
6250 LOCATE 6,20:PRINT AB$(5)
6260 LOCATE 8,20:PRINT CB$(4)
6270 LOCATE 9,18-EB(1):PRINT OP$;CB$(2);CC$
6280 LOCATE 10,20:PRINT AB$(6)
6290 FC$=STRING$(EB(1)+EB(4)+1,"?")
6300 LOCATE 11,20-EB(1):PRINT FC$
6310 LOCATE 13,20:PRINT EC$
6320 LOCATE 14,20:PRINT ANS$
6330 YAX=12
6340 IF ANV>0 THEN XAX=20+ANT ELSE XAX=21-DNT
6350 IF RE=1 GOTO 560
6360 LOCATE 23,1:PRINT "To correct an entry, press c"
6370 IF RE=1 GOTO 560
6380 IF CN=0 OR EC$=" %" THEN YAX=YAX+1
6390 IF CNT=2 THEN XAX=XAX-1
6400 X=XAX
6410 WW=ABS(WW)
6420 FOR I=1 TO WW
6430 LOCATE YAX,XAX,1
6440 Q$(I)=INPUT$(1)
6450 IF Q$(I)<>"c" AND Q$(I)<>"C" GOTO 6560
6460 IF I=1 GOTO 6430
6470 I=I-1
6480 IF CNT>0 AND I=CNT+1 GOTO 6470
6490 IF I<>CNT GOTO 6540
6500 YAX=YAX-1
6510 XAX=X
6520 I=1
6530 GOTO 6430
6540 XAX=XAX-1
6550 GOTO 6430
6560 IF Q$(I)<"0" OR Q$(I)>"9" GOTO 6440
6570 PRINT Q$(I)
6580 IF I<>CNT GOTO 6650
6590 YAX=YAX+1
6600 IF GRD=4 AND FORMAT=4 OR GRD>4 AND FORMAT=3 THEN XAX=20-DNT+1 ELSE XAX=23
6610 IF I=2 THEN SWAP Q$(1),Q$(2)
6620 Q$(I+1)=" "
6630 I=I+1
6640 GOTO 6660
6650 XAX=XAX+1
6660 NEXT I
6670 IF DN>9 THEN SWAP Q$(WW),Q$(WW-1)
6680 IF EC$=" %"THEN Y$=EC$ ELSE Y$=ANU$
6690 FOR I=1 TO WW
6700 Y$=Q$(I)+Y$
6710 NEXT I
6720 Y$=" "+Y$
6730 LOCATE 21,1:PRINT "Press ";CHR$(17);CHR$(196);CHR$(217);" ";
6740 E$=INPUT$(1)
6750 IF E$<>"c" AND E$<>"C" GOTO 6790
6760 IF CNS$<>"" THEN YAX=YAX-1
6770 XAX=X
6780 GOTO 6420
6790 IF E$<>CHR$(13) GOTO 6740
6800 GOTO 450
6810 BN=B(3)+B(4)
6820 OP$=" +"
6830 RETURN
6840 BN=B(3)-B(4)
6850 OP$=" -"
6860 RETURN
6870 BN=B(3)*B(4)
6880 OP$=" x"
6890 RETURN
6900 BN=B(3)*B(4)
6910 OP$=" ?"
6920 RETURN
6930 QTY=1
6940 GOSUB 7480
6950 IF MPROB>PROB GOTO 610
6960 CLS
6970 LOCATE 1,7:PRINT"OK " MICK$", here is problem "PROB
6980 LOCATE 3,1:PRINT "I am thinking of a number from 1 -"BND-1"Can you find it!"
6990 LOCATE 5,5,1:PRINT"(After each answer, press ";CHR$(17);CHR$(196);CHR$(217);")"
7000 IF RE=1 GOTO 560
7010 PRINT
7020 FOR H=1 TO 12
7030 XAX=1
7040 YAX=CSRLIN
7050 FOR I=1 TO 4
7060 LOCATE YAX,XAX
7070 J$(I)=INPUT$(1)
7080 IF J$(I)=CHR$(13) GOTO 7200
7090 IF J$(I)<>"c" AND J$(I)<>"C" GOTO 7140
7100 IF I=1 GOTO 7070
7110 I=I-1
7120 XAX=XAX-1
7130 GOTO 7060
7140 IF J$(I)<"0" OR J$(I)>"9" GOTO 7070
7150 PRINT J$(I);
7160 XAX=XAX+1
7170 NEXT I
7180 LOCATE YAX,1:PRINT"    ";
7190 IF J$(I)<>CHR$(13) GOTO 7030
7200 Y$=" "
7210 FOR K=1 TO I-1
7220 Y$=Y$+J$(K)
7230 NEXT K
7240 A=VAL(Y$)
7250 IF A>B(1) THEN PRINT" It's lesser!"
7260 IF ABND GOTO 7610
7700 OP$="+"
7710 RETURN
7720 QTY=2
7730 J$="":K$=""
7740 FOR H=1 TO 3
7750 GOSUB 7480
7760 IF B(1)+B(2)3 THEN B(I)=B(I)-4
7790 NEXT I
7800 GOTO 7760
7810 JJ$=STR$(B(1))
7820 KK$=STR$(B(2))
7830 J$=J$+JJ$
7840 K$=K$+KK$
7850 NEXT H
7860 B(1)=VAL(J$)
7870 B(2)=VAL(K$)
7880 IF B(1)0 GOTO 8090
8070 LOCATE 3,11:PRINT"You did "PROB" problems"
8080 LOCATE 6,11:PRINT"Your score is "SCORE "%"
8090 IF LL$>" " GOTO 8150
8100 LOCATE 12,1:PRINT"Great work, "MICK$;
8110 IF SEL=3 GOTO 8170
8120 PRINT". Some more? (y/n)"
8130 BASE=BASE+1
8140 GOTO 8260
8150 LOCATE 9,1:PRINT"You missed problem:"LL$
8160 IF SEL<>3 GOTO 8200
8170 PRINT"....Enter code."
8180 E$=INPUT$(1)
8190 IF E$<>"{" GOTO 8180
8195 IF SEL=3 AND LL$="" THEN 8480
8200 PRINT
8210 IF SEL=2 GOTO 8250
8220 PRINT "Do you want to see the problems missed? (y/n) "
8230 RE=1
8240 GOTO 8270
8250 PRINT "Do you want to redo the problems missed?(y/n) "
8260 RE=0
8270 E$=INPUT$(1)
8280 IF E$="n" OR E$="N" GOTO 8480
8290 IF E$<>"y"  AND E$<>"Y" GOTO 8270
8300 ANA=LEN(LL$)
8310 IF ANA=0 GOTO 330
8320 MISS=0
8330 FOR GG=1 TO ANA
8340 U$=MID$(LL$,GG,1)
8350 IF U$<>" " THEN UU$=UU$+U$
8360 IF U$=" " OR GG=ANA THEN GOSUB 8410
8370 IF U$=" " THEN UU$=""
8380 NEXT GG
8390 MPROB=0:LL$=""
8400 GOTO 7940
8410 IF UU$<"1" THEN RETURN
8420 MPROB=VAL(UU$)
8430 UU$=" "
8440 MISS=MISS+1
8450 CLS
8460 LOCATE 13,11,0:PRINT"One moment, please!"
8470 IF MISS=1 GOTO 330 ELSE GOTO 370
8480 CLS
8490 LOCATE 13,11,0:PRINT"One moment, please!"
8500 CHAIN "a:tutor"
8510 TYP$="1121211112"
8520 BNDA=9:BNDB=9:BNDC=10:BNDD=9:BNDE=99
8530 RETURN
8540 TYP$="1221113112"
8550 BNDA=99:BNDB=12:BNDC=18:BNDD=5:BNDE=999
8560 RETURN
8570 TYP$="1324311432"
8580 BNDA=999:BNDB=9:BNDC=5:BNDD=99:BNDE=999
8590 RETURN
8600 TYP$="1321421232"
8610 BNDA=9999:BNDB=99:BNDC=999:BNDD=12:BNDE=12
8620 RETURN
8630 TYP$="1421413243"
8640 BNDA=999:BNDB=99:BNDC=18:BNDD=18:BNDE=18
8650 RETURN
8660 TYP$="1321414242"
8670 BNDA=9999:BNDB=999:BNDC=24:BNDD=24:BNDE=24
8680 RETURN