1000 Rem Aritm v0.3 for TinyBASIC Two is FOSS. 1010 Rem TinyBASIC 2 Flavour: Humbug or Vanilla. 1020 Rem (C) 1992-2013 by Mikael O. Bonnier, Lund, Sweden. 1030 Rem E-mail: . 1040 Rem Absolutely no warranty. 1050 Rem License GPLv3+, see 1060 Rem . 1070 Rem More programs at 1080 Rem . 1090 Rem Documentation: 1100 Rem 876543210, 8:Type, 7-5:Op1, 4-3:Op2, 2:Res'd, 1-0:#Todo. 1110 Rem Program: 1120 Rem Lbl C 1130 GoSub 3410;Rem ClS 1140 Let A=0 1150 If (L>0)*M Then Goto 3000;Rem ContMenu 1160 If 0=M Then Let M=10 1170 Goto 3030;Rem Menu 1180 Rem Lbl S 1190 GoSub 3410;Rem ClS 1200 Print "Generating" 1210 Print "Problems..." 1220 Let U=1 1230 Let @(N)=0 1240 Rem Lbl Add1 1250 If 0=M/10%10 Then Goto 1320;Rem Add2 1260 For I=0 To 9 1270 For J=0 To 9 1280 Let @(U)=100000000+I*100000+J*1000+1 1290 Let U=U+1 1300 Next J 1310 Next I 1320 Rem Lbl Add2 1330 If 0=M/100%10 Then Goto 1410;Rem Sub1 1340 For I=0 To 9 1350 For J=0 To 9 1360 Let T=10*rnd(8) 1370 Let @(U)=200000000+(T+I)*100000+J*1000+1 1380 Let U=U+1 1390 Next J 1400 Next I 1410 Rem Lbl Sub1 1420 If 0=M/1000%10 Then Goto 1490;Rem Sub2 1430 For I=0 To 9 1440 For J=I To 9+I 1450 Let @(U)=300000000+J*100000+I*1000+1 1460 Let U=U+1 1470 Next J 1480 Next I 1490 Rem Lbl Sub2 1500 If 0=M/10000%10 Then Goto 1580;Rem Mul 1510 For I=0 To 9 1520 For J=I To 9+I 1530 Let T=10*rnd(9) 1540 Let @(U)=400000000+(T+J)*100000+I*1000+1 1550 Let U=U+1 1560 Next J 1570 Next I 1580 Rem Lbl Mul 1590 If 0=M/100000%10 Then Goto 1660;Rem Div 1600 For I=0 To 9 1610 For J=0 To 9 1620 Let @(U)=500000000+I*100000+J*1000+1 1630 Let U=U+1 1640 Next J 1650 Next I 1660 Rem Lbl Div 1670 If 0=M/1000000%10 Then Goto 1750;Rem EndIf 1680 For I=0 To 9 1690 For J=1 To 9 1700 Let T=I*J+rnd(J)-1 1710 Let @(U)=600000000+T*100000+J*1000+1 1720 Let U=U+1 1730 Next J 1740 Next I 1750 Rem Lbl EndIf 1760 Let U=U-1 1770 Let L=U 1780 Rem Lbl U 1790 Print "Shuffling..." 1800 For I=U To 2 Step -1 1810 Let J=rnd(I) 1820 Let T=@(I) 1830 Let @(I)=@(J) 1840 Let @(J)=T 1850 Next I 1860 Let K=1 1870 Rem Lbl K 1880 GoSub 3410;Rem ClS 1890 Print #1,L," problems left. -1 Esc" 1900 Let T=@(K) 1910 Let C=T/100000000 1920 If 6=C Then Print "Integer part of ", 1930 Let I=(T/100000)%1000 1940 Print #1,I, 1950 GoSub 3280;Rem Sign 1960 Let J=(T/1000)%100 1970 Print #1,J, 1980 Input " = ",A 1990 If -1=A Then Goto 1120;Rem C 2000 If (1=C)+(2=C) Then Let R=I+J;Goto 2040;Rem EndIf 2010 If (3=C)+(4=C) Then Let R=I-J;Goto 2040;Rem EndIf 2020 If 5=C Then Let R=I*J;Goto 2040;Rem EndIf 2030 If 6=C Then Let R=I/J 2040 Rem Lbl EndIf 2050 If R#A Then GoTo 2140;Rem Wrong 2060 Print "Right! ", 2070 If 0>=T%100 Then Goto 2100;Rem EndIf 2080 Let L=L-1 2090 Let @(K)=T-1 2100 Rem Lbl EndIf 2110 Let K=K+1 2120 If 0=L GoTo 2390;Rem W 2280 Print "Checking..." 2290 Let N=1 2300 For K=1 To U 2310 Let T=@(K) 2320 If 0=T%100 Then Goto 2350;Rem EndIf 2330 Let @(N)=T 2340 Let N=N+1 2350 Rem EndIf 2360 Next K 2370 Let U=N-1 2380 Goto 1780;Rem U 2390 Rem Lbl W 2400 Print "Good!!! Well done!" 2410 Wait Delay,5000 2420 Goto 1120;Rem C 2430 Rem Lbl E 2440 GoSub 3410;Rem ClS 2450 Let A=0 2460 Let N=0 2470 Let T=M 2480 GoSub 2640;Rem Sub 2490 Print "Addition 1" 2500 GoSub 2640;Rem Sub 2510 Print "Addition 2" 2520 GoSub 2640;Rem Sub 2530 Print "Subtraction 1" 2540 GoSub 2640;Rem Sub 2550 Print "Subtraction 2" 2560 GoSub 2640;Rem Sub 2570 Print "Multiplication" 2580 GoSub 2640;Rem Sub 2590 Print "Division | -1 Esc" 2600 Print "0 OK and Go ", 2610 Goto 2760;Rem After Sub 2640 Rem Sub 2650 Let A=A+1 2660 Let T=T/10 2670 Print #1,A, 2680 If 0=T%10 Then Goto 2720;Rem Else 2690 Print "*", 2700 Let N=N+100-10*(6=A) 2710 Goto 2740;Rem End If 2720 Rem Lbl Else 2730 Print " ", 2740 Rem Lbl End If 2750 Return 2760 Rem Lbl After Sub 2770 Print #1,N 2780 Rem Lbl Input 2790 Input "Toggle item 1-6, or choose 0 or -1: ",A 2800 If (-1>A)+(60), 3140 Input ": ",S 3150 If (1>S)+(4+(L>0)0 3360 Let R=1 3370 For I=1 To A 3380 Let R=R*10 3390 Next I 3400 Return 3410 Rem Sub ClS 3420 For T=1 To 24 3430 Print 3440 Next T 3450 Print "Aritm" 3460 Return 3470 Rem Sub Help 3480 GoSub 3410;Rem ClS 3490 Print "Help" 3500 Print "You can mix problems anyway you like." 3510 Print "More help on ." 3520 Wait Delay,5000 3530 Return 3540 Rem Sub About 3550 GoSub 3410;Rem ClS 3560 Print "About" 3570 Print "Aritm 0.3 (C) 1992-2013 by" 3575 Print "Mikael O. Bonnier, Lund, Sweden." 3580 Print "Absolutely no warranty." 3585 Print "FOSS, see license GPLv3+." 3590 Wait Delay,5000 3600 Return