8-Bit Software Online Conversion
:2.$.TEDDY2 - Listing
1REM *** LISTING 2 ***
2P%=PAGE:IF P%=&E00 THEN 10
3VDU21
4*KEY0 *T.|MDELETE1,6|MF.I%=0 TO TOP
-PAGE S.4:I%!&E00=I%!P%:N.|MPA.=&E00|MEN
D|MVDU6|MRUN|M
5*FX138,0,128
6END
10CLS:COLOUR3:PRINT'TAB(7)"PRESS ANY
KEY WHEN READY";
20KEY%=INKEY(8000)
30PROCinit
40REPEAT
50MODE1
60PROCdifficulty
70MODE2
80QUESTION=0
90REPEAT
100QUESTION=QUESTION+1
110PROCquestion
120UNTIL QUESTION=10
130PROCend
140UNTIL AA$<>"Y"
150MODE7
160END
170DEF PROCinit
180VDU26:CLS
190HEAD$=CHR$226+CHR$227+CHR$11+CHR$8+
CHR$8+CHR$224+CHR$225
200MIDDLE$=CHR$230+CHR$231+CHR$11+CHR$
8+CHR$8+CHR$228+CHR$229+CHR$11+CHR$8+CHR
$8
210BOTTOM$=CHR$234+CHR$235+CHR$11+CHR$
8+CHR$8+CHR$232+CHR$233+CHR$11+CHR$8+CHR
$8
220TEDDY$=BOTTOM$+MIDDLE$+HEAD$
230WAISTCOATtop$=CHR$238+CHR$239+CHR$1
1+CHR$8+CHR$8+CHR$236+CHR$237
240WAISTCOATbottom$=CHR$11+CHR$240+CHR
$241+CHR$11+CHR$8+CHR$8
250WAISTCOAT$=WAISTCOATbottom$+WAISTCO
ATtop$
260EYE$=CHR$11+CHR$11+CHR$11+CHR$11+CH
R$11+CHR$242+CHR$243
270WIPE$=CHR$11+CHR$244+CHR$244+CHR$11
+CHR$8+CHR$8+CHR$244+CHR$244
280BOWTIE$=CHR$11+CHR$11+CHR$11+CHR$24
5+CHR$246:REM +CHR$11+CHR$8+CHR$8+CHR$24
7+CHR$248
290A%=0:D%=0:E%=0:F%=0:FLAG%=0
300DIMA$(10),B$(10)
310FORX%=1TO10:READ A$(X%):NEXT
320FORX%=1TO10:READ B$(X%):NEXT
330DATA"01280576","0000057602560576","
006408320320083201920320","0064083203200
8320064032003200320","006408320192083203
2008320064032003200320"
340DATA"006408320320083201280576025605
760064032003200320","0064083201920832000
0057601280576025605760064032001920320"
350DATA"006408320192083203200832012805
7602560576006403200192032003200320","006
4083201920832032008320000057601280576025
60576006403200192032003200320"
360DATA"006408320192083203200832000005
7601280576025605760384057600640320019203
2003200320"
370DATA"08960576","0768057610240576","
083208321088083209600320","0832083210880
8320832032010880320"
380DATA"083208320960083210880832083203
2010880320","083208321088083208960576102
405760832032010880320"
390DATA"083208320960083207680576089605
76102405760832032009600320"
400DATA"083208320960083210880832089605
7610240576083203200960032010880320","083
2083209600832108808320768057608960576102
40576083203200960032010880320"
410DATA"083208320960083210880832076805
7608960576102405761152057608320320096003
2010880320"
420ENDPROC
430DEF PROCquestion
440GCOL0,6:MOVE0,256:DRAW1280,256
450VDU28,0,31,19,25
460LOCALA%,B%,C%
470A%=RND(G%):B%=RND(G%):C%=A%+B%
480VDU5:MOVE544,992:PRINT"ADD"
490MOVE520,1024:DRAW520,256:MOVE752,25
6:DRAW752,1024
500L$=STR$(A%):LL$=STR$(B%)
510GCOL0,7:IF LEN(L$)<2 THEN MOVE672,8
00:PRINT;A%; ELSE MOVE608,800:PRINT;A%;
520VDU4:COLOUR7
530PROCsound2(150):PRINTTAB(1-LEN(L$),
27);L$;
540PROCteddy(A$(A%))
550PRINT;" + ";LL$;:PROCsound2(100)
560VDU5:GCOL0,7::MOVE536,704:PRINT;"+"
;:IF LEN(LL$)<2 THEN MOVE672,704:PRINT;B
%;:VDU4 ELSE MOVE608,704:PRINT;B%;:VDU4
570PROCteddy(B$(B%))
580PRINT;" makes ";
590GCOL0,7:MOVE528,640:DRAW744,640:MOV
E528,544:DRAW744,544:MOVE528,528:DRAW744
,528
600PROCon
610*FX15,1
620PROCsound2(50):INPUTAN%
630IF AN%<1 OR AN%>20 THEN CLS:PRINT;A
%;" + ";B%;" MAKES ";:GOTO620
640PROCoff
650LLL$=STR$(AN%)
660VDU5:IF LEN LLL$<2 THEN MOVE 672,60
8:PRINT;AN%;:VDU4 ELSE MOVE608,608:PRINT
;AN%;:VDU4
670IF AN%=C% PROCoff:PROCcorrect:FLAG%
=0:VDU26:CLS:ENDPROC
680PROCcross
690IF FLAG%=0 THEN PROCwrong:COLOUR7:G
OTO530 ELSE CLS:COLOUR3:PRINT'"YOU'RE ST
ILL WRONG!"''"TRY A NEW SUM":PROCwait(3)
:PROCsound2(RND(180)+50):VDU26:CLS:FLAG%
=0:ENDPROC
700ENDPROC
710DEFPROCteddy(A$)
720LOCALX%,Y%
730VDU5
740FORX%=1 TO LEN(A$) STEP 8
750x%=VAL(MID$(A$,X%,4)):y%=VAL(MID$(A
$,X%+4,4))
760MOVE x%,y%
770GCOL0,3
780PRINTTEDDY$
790V%=RND(7)
800IF V%=3 THEN 790
810GCOL0,V%
820MOVE x%,y%
830PRINTWAISTCOAT$
840GCOL0,15
850MOVEx%,y%
860PRINTEYE$
870V%=RND(7):IFV%=3THEN870
880GCOL0,V%
890MOVEx%,y%
900PRINTBOWTIE$
910NEXT
920VDU4
930PROCoff
940ENDPROC
950DEF PROCcorrect
960PROCoff:PROCtick:COLOUR3:PRINT'"WEL
L DONE!":RESTORE1930:PROCtune:PRINT'"THA
T IS RIGHT":PROCwait(3):CLS:PROCwipe:VDU
26:CLS
970IF (FLAG%=0 AND D%=0) THEN E%=E%+1
980D%=0
990ENDPROC
1000DEF PROCwrong
1010PROCoff:D%=D%+1:IF D%>2 THEN PROCte
ll(A$(A%),B$(B%)):PROCwait(3):PROCsound2
(RND(180)+50):PRINT'"TRY AGAIN":PROCwait
(3):CLS:PROCwipe:ENDPROC
1020IF D%=1 F%=F%+1
1030COLOUR3:PRINT'"THAT IS WRONG!":PROC
wrongsound:PRINT'"TRY AGAIN":PROCwait(3)
:CLS:PROCwipe:ENDPROC
1040DEF PROCtell(A$,B$)
1050FLAG%=1
1060COLOUR3
1070PRINT'"WRONG AGAIN!":PROCwrongsound
:CLS:VDU24,550;650;720;800;:CLG:VDU24,60
8;560;720;620;:CLG:VDU26:VDU28,0,31,19,2
5:PRINT'"LETS COUNT THEM "''"TOGETHER":P
ROCwait(3)
1080N%=1
1090VDU5
1100FORX%=1 TO LEN(A$) STEP 8
1110x%=VAL(MID$(A$,X%,4)):y%=VAL(MID$(A
$,X%+4,4))
1120MOVEx%,y%
1130GCOL0,0
1140PRINTWIPE$
1150IF N%<10 MOVEx%+28,y%+50 ELSE MOVEx
%,y%+50
1160GCOL0,7
1170PRINT;N%;
1180PROCsound(50+(N%*5))
1190PROCwait(3)
1200N%=N%+1
1210NEXT
1220FOR X%=1 TO LEN(B$) STEP 8
1230x%=VAL(MID$(B$,X%,4)):y%=VAL(MID$(B
$,X%+4,4))
1240MOVEx%,y%
1250GCOL0,0
1260PRINTWIPE$
1270IF N%<10 MOVEx%+28,y%+50 ELSE MOVEx
%,y%+50
1280GCOL0,7
1290PRINT;N%;
1300PROCsound(50+(N%*5))
1310PROCwait(3)
1320N%=N%+1
1330NEXT
1340D%=0:N%=0
1350VDU4
1360PROCoff
1370CLS
1380COLOUR7
1390PRINTTAB(1-LEN(L$),27);L$;:VDU5:GCO
L0,7:IF LEN(L$)<2 THEN MOVE672,800:PRINT
;A%;:VDU4 ELSE MOVE608,800:PRINT;A%;:VDU
4
1400PROCoff:PROCsound2(180):PROCwait(2)
:PRINT;" + ";:VDU5:GCOL0,7::MOVE536,704:
PRINT;"+";:VDU4
1410PROCoff:PROCsound2(120):PROCwait(1)
:PRINT;LL$;:VDU5:IF LEN(LL$)<2 THEN MOVE
672,704:PRINT;B%;:VDU4 ELSE MOVE608,704:
PRINT;B%;:VDU4
1420PROCoff:PROCsound2(80):PROCwait(2):
PRINT;" makes ";
1430C$=STR$(C%):PROCwait(2):PRINT;C%;:P
RINT:VDU5:IF LEN C$<2 THEN MOVE 672,608:
PRINT;C%;:ELSE MOVE608,608:PRINT;C%;
1440VDU4:PROCoff:PROCsound2(90):PROCwai
t(4)
1450COLOUR3
1460ENDPROC
1470DEFPROCtick:GCOL0,7:MOVE0,0:MOVE102
4,160:DRAW1056,128:DRAW1104,216:ENDPROC
1480DEFPROCcross:GCOL0,7:MOVE0,0:MOVE10
24,208:DRAW1120,112:MOVE1024,112:DRAW112
0,208:ENDPROC
1490DEF PROCend
1500CLS
1510PRINT''''''" You have had 10"''"
questions"''" You got ";E%;" right"''"
and ";F%;" wrong."
1520PROCon
1530PRINT''''''"Another go (Y/N)?";:REP
EAT:AA$=GET$:UNTIL AA$="Y" OR AA$="N"
1540PROCoff
1550E%=0:F%=0
1560ENDPROC
1570DEF PROCwipe
1580VDU26
1590PROCoff
1600LOCALY%
1610FORY%=0 TO 22:PRINTTAB(0,Y%)SPC(8);
TAB(12,Y%)SPC(8);:NEXT
1620VDU24,608;560;720;620;:CLG:VDU26
1630VDU28,0,31,19,25
1640ENDPROC
1650DEFPROCoff:VDU23,1,0;0;0;0;:ENDPROC
1660DEF PROCon:VDU23,1,1;0;0;0;:ENDPROC
1670DEF PROCwait(W%)
1680LOCALT%
1690T%=TIME:REPEAT UNTIL TIME=T%+(W%*10
0):ENDPROC
1700DEFPROCsound(S%):SOUND1,1,S%,1:ENDP
ROC
1710DEFPROCsound2(S%):SOUND2,1,S%,1:END
PROC
1720DEF PROCdifficulty
1730CLS
1740VDU19,3,5,0,0,0
1750COLOUR2
1760PRINTTAB(2,5)"Level of difficulty:-
"
1770PRINTTAB(6,10)"1 - Random numbers u
pto 4"
1780PRINTTAB(6,13)"2 - Random numbers u
pto 6"
1790PRINTTAB(6,16)"3 - Random numbers u
pto 8"
1800PRINTTAB(6,19)"4 - Random numbers u
pto 10"
1810COLOUR3:PRINTTAB(2,26)"Please make
your selection ";:REPEAT:DIFFICULTY%=GET
-48:UNTILDIFFICULTY%>0 AND DIFFICULTY%<5
1820G%=DIFFICULTY%*2+2
1830ENDPROC
1840DEF PROCwrongsound:FOR I%=190 TO 0
STEP-4:SOUND1,-15,I%,1:NEXT:ENDPROC
1850DEF PROCtune
1860REPEAT
1870READ p%,d%
1880IF p%=-1 THEN 1910
1890SOUND 2,-15,p%,2*d%/3
1900SOUND 1,-6,p%,2*d%/3
1910UNTIL p%=-1
1920ENDPROC
1930DATA 13,5,33,10,49,5,41,5,49,5,41,5
,33,10,49,5,41,10,49,5,33,5,41,5,49,5,41
,10,49,5,33,20,-1,-1
1940 IF ERR=17 THEN *GDUMP 0 2 9
1950 CLS:PRINTERR
1960STOP