10REM"
20REM"
40REM"
60REM" For Laura Davison. 3 hours wor
k.
70REM" ------------------------------
--
80REM" This program is Public domai
n.
90REM" Please do not alter it in
any
100REM" way. If you use any of
the
110REM" routines, please mention
me
120REM" in the titles. Thanks, C
JR.
130REM" -----------------------------
---
140DEFFNS="selftes"
150IF PAGE<>&1900:PAGE=&1900:CHAIN"sel
ftes"
155ONERROR IF ERR=17 END ELSE CLOSE#0:
REPORT:PRINTERL:PRINT"PRESS A KEY":REPEA
TUNTILGET
160OSCLI"K.0 ":OSCLI"K.1 ":OSCLI"K.2 "
:OSCLI"K.3 ":OSCLI"K.4 ":OSCLI"K.5 ":OSC
LI"K.6 ":OSCLI"K.7 ":OSCLI"K.8 "
170MODE7:S%=0
180PROCd("Self test program for L.Davi
son"):PROCd("By C.J.Richardson")
190OSCLI".":PRINT
200PROCd("Enter a filename"):PROCd("or
press RETURN to continue")
210INPUT$&900:IF$&900<>"":F%=OPENIN$&9
00:INPUT#F%,Q%:DIMQ$(Q%):FORL%=1TOQ%:INP
UT#F%,Q$(L%):NEXT:CLOSE#F%
220IF$&900="" Q%=100:DIMQ$(Q%):
REM" Q% IS THE NUMBER OF QUESTIONS
230ONERRORVDU3:CLOSE#0:REPORT:PRINTERL
:PRINT"PRESS A KEY":REPEATUNTILGET
240REPEAT:*FX21
250CLS:PRINT':PROCd("Self test"):PRINT
''
260PROCd("(L)oad"):PROCd("(S)ave"):PRO
Cd("(A)dd"):PROCd("(E)dit"):PROCd("(R)ea
d"):PROCd("(T)est. Best so far="+STR$S%)
270I$=GET$:CLS
280IFASCI$>96 I$=CHR$(ASC(I$)-32)
290IF I$="L" PROCd("RESTART. Are you s
ure? Y/N"):IF GET$="Y" RUN
300IF I$="S":OSCLI".":INPUT" Filename
to save "$&900:F%=OPENOUT$&900:PRINT#F%,
Q%:FORL%=1TOQ%:PRINT#F%,Q$(L%):NEXT:CLOS
E#F%
310IF I$="A" PROCadd
320IF I$="E" PROCedit
330IF I$="R" PROCread
340IF I$="T" PROCplay
350UNTILFALSE
360END
370DEFPROCadd:L%=0:REPEAT:L%=L%+1:UNTI
LL%=Q% OR Q$(L%)=""
380IF Q$(L%)<>"":PROCd("NO ROOM! Press
a key"):REPEATUNTILGET:ENDPROC
390PROCd("Add number:"+STR$L%)
400PROCget:ENDPROC
410DEFPROCedit:PROCd("Enter question n
umber to edit"):INPUT L%
420PROCsplit
430PROCd("Question:"):PRINTQ$
440PROCd("Answer:"):PRINTA$
450PROCget:ENDPROC
460DEFPROCread:PROCd("To Printer? Y/N"
):IFGET$="Y"VDU2 ELSE VDU14:PROCd("Shift
to scroll")
470FORL%=1TOQ%:IF Q$(L%)<>"" PROCsplit
:PRINT" Question:";STR$L%'Q$'" Answer:";
STR$L%'A$:NEXT ELSE NEXT
480VDU15,3:PROCd("Press a key"):REPEAT
UNTILGET:ENDPROC
490DEFPROCget:PROCd("Enter the questio
n and answer"):PROCd("Use the format:")
500PROCd("Question**Answer")
510T$="":C%=0:REPEAT
520T%=GET:IF T%<>127VDUT%
530IF T%=127 IF C%<>0 IF RIGHT$(T$,1)<
>"*" T$=LEFT$(T$,LENT$-1):C%=C%-1:VDU127
ELSE IF T%<>13 IF T%<>127 T$=T$+CHR$T%:
C%=C%+1
540IFRIGHT$(T$,2)="**"IFT%<>127PRINT:P
ROCd("Answer:")
550UNTILT%=13 OR C%=255
560Q$(L%)=T$:IF T$<>"" IF INSTR(T$,"**
")=0PROCd("The format is incorrect!"):PR
OCd("Press a key"):REPEATUNTILGET
570ENDPROC
580DEFPROCplay
590S%=0:L%=0
600PRINT':PROCd("Test"):PROCd("(R)ando
m or "):PROCd("(S)equential")
610IF INSTR("Rr",GET$) T%=1 ELSE T%=0
620REPEAT:CLS:PROCd("Score:"+STR$S%)
630IF T%=1 Q$(L%)="":PROCgetnext ELSE
L%=L%+1
640PROCsplit:PROCd("Question "+STR$L%)
:PRINTQ$
650INPUT'T$:A$=FNcase(A$):T$=FNcase(T$
)
660IF T$=A$:S%=S%+2:PROCd("FULLY CORRE
CT!")
670IF T$<>A$ IF LENT$>LENA$/2 S%=S%+1:
IF INSTR(A$,T$)ORINSTR(T$,A$):PROCd("PAR
TLY CORRECT! Answer is:"):PRINT'A$ ELSE
IF T$<>A$ PROCd("WRONG! Answer is:"):PRI
NT'A$
680PRINT:PROCd("PRESS A KEY"):REPEATUN
TILGET
690UNTILL%=Q%
700ENDPROC
710DEFFNcase(I$):FORI%=1TOLENI$:J%=ASC
(MID$(I$,I%))
720IFJ%>96 I$=LEFT$(I$,I%-1)+CHR$(J%-3
2)+MID$(I$,I%+1)
730NEXT:=I$
740DEFPROCgetnext:Z%=0:REPEAT:Z%=Z%+1:
L%=RND(Q%-1):UNTILQ$(L%)<>""OR Z%=30
750IFZ%=30:L%=0:REPEAT:L%=L%+1:UNTILL%
=Q% OR Q$(L%)<>""
760ENDPROC
770DEFPROCsplit:Q$=LEFT$(Q$(L%),INSTR(
Q$(L%),"**")-1):A$=MID$(Q$(L%),INSTR(Q$(
L%),"**")+2):ENDPROC
780DEFPROCd(D$):PRINTTAB(16-LEN(D$)/2)
;"