home *** CD-ROM | disk | FTP | other *** search
- REM ****** Startup calls to give the test a reality ****
- REM ***** and a place to call home. !(Phone_Home) *****
-
- GOSUB Initize : REM ** Call Screen, Window, Colors, and
- REM ** Variable initialization Routine.
- REM ****** Main Program Driver
- Main: GOSUB Reseed : REM * Reseed Random # Generator ??
- GOSUB Question : REM * Make up a question
- GOSUB Answer : REM * Get an answer or null
-
- REM ** Handle "NULL" string answer
- IF Answer$ = "" THEN
- GOSUB Wrong
- GOTO Main
- END IF
-
- REM ** Student wishes to pause ??
- IF ASC(Answer$) = 27 THEN
- LOCATE 15,2 : PRINT " "
- GOSUB PauseMode
- LOCATE 15,2: PRINT "Press <ESC> to Pause"
- GOTO Main
- END IF
-
- REM ** Is he right or wrong ??
- IF Answer$ = LEFT$(Character$(Quest),1) THEN
- GOSUB Right
- GOTO Main
- ELSE
- GOSUB Wrong
- GOTO Main
- END IF
-
- GOTO Main : REM *** Just in case ***
- REM ***** Random Reseeder Routine ******
-
- Reseed: REM *** label ***
-
- Reseed% = Reseed% + 1
- IF Reseed% >= 25 THEN
- RANDOMIZE TIMER
- Reseed% = 0
- END IF
-
- RETURN
-
- REM ****** Question generator Routine ******
-
- Question: REM *** label ***
-
- QRestart: Quest = INT((MaxChars+1)*RND(2))
- FOR t = 1 TO 10
- junk$ = INKEY$
- NEXT t
-
- LOCATE 7,16
- PRINT Character$(Quest);" "
-
- RETURN
-
- REM *** Get an Answer Routine *****
-
- Answer:
- FOR Count = 1 TO Speed
- Answer$ = INKEY$
- IF Answer$ <> "" THEN
- ActualTime = Count
- Count = Speed
- END IF
- NEXT Count
-
- RETURN
-
- REM ***** Right Answer Handling Routine ******
-
- Right:
- LOCATE 5,10
- PRINT "RIGHT!"
- Right = Right + 1
- LOCATE 10,2
- PRINT "Right : ";Right;" "
- GOSUB Percent
- IF Speed <= 200 THEN
- Speed = 200
- ELSE
- Speed = Speed - 8
- END IF
- Points = Points + (10+INT(10*(400/ActualTime)))
- LOCATE 2,15
- PRINT "Points: ";Points;" "
-
- RETURN
-
- REM ***** Wrong Answer Handling Routine
-
- Wrong:
- BEEP
- LOCATE 5,10
- PRINT "WRONG!"
- Speed = Speed + 40
- Wrong = Wrong + 1
- LOCATE 11,2
- PRINT "Wrong : ";Wrong;" "
- GOSUB Percent
- Points = Points - (5+INT(Speed/200))
- LOCATE 2,15
- PRINT "Points: ";Points;" "
-
- RETURN
-
- REM ****** Percentage Calculation Routine ******
-
- Percent:
- Percent = (Right/(Right+Wrong)*100)
- LOCATE 12,2
- PRINT "Percent Right : ";Percent;" "
-
- RETURN
-
- REM **** Pause Mode a la mode ****
- PauseMode:
- WINDOW 5,"The Test is now in Pause Mode",(0,131)-(310,180),0,2
- PRINT "Pause Menu:"
- PRINT "Resume Test - <ESC> Key
- PRINT "Start New Test - CTRL-R"
- PRINT "Quit Program - CTRL-Q"
- ReChoose: choice$ = INKEY$
- IF choice$ = "" THEN GOTO ReChoose
- REM **** Resume or not ? ****
- IF ASC(choice$) = 27 THEN
- ResumeFlag = -1
- GOTO EndPause
- ELSE
- ResumeFlag = 0
- END IF
- REM ***** Restart or not ? *****
- IF ASC(choice$) = 18 THEN
- RestartFlag = -1
- GOTO EndPause
- ELSE
- RestartFlag = 0
- END IF
-
- REM ***** Quit or not ? ****
- IF ASC(choice$) = 17 THEN
- QuitFlag = -1
- GOTO EndPause
- ELSE
- QuitFlag = 0
- GOTO ReChoose
- END IF
-
- EndPause: WINDOW OUTPUT 4
- WINDOW CLOSE 5
- LOCATE 15,2: PRINT "Press <ESC> to Pause"
- IF ResumeFlag THEN GOTO Main
- IF RestartFlag THEN
- LOCATE 16,2
- PRINT "Are you sure you want to"
- PRINT " start a NEW test (Y/N) ?"
- Wait6: Resp$ = INKEY$
- IF Resp$ = "" THEN GOTO Wait6
- IF (UCASE$(Resp$)<>"Y" AND UCASE$(Resp$)<>"N") THEN GOTO Wait6
- LOCATE 16,2:
- PRINT " "
- PRINT " "
- IF UCASE$(Resp$) = "N" THEN
- GOTO Main
- ELSE
- GOSUB Startup
- GOTO Main
- END IF
- END IF
- IF QuitFlag THEN GOTO Quitter
-
- RETURN
-
- REM ***** Startup and Restart Menu *******
-
- Startup:
- WINDOW 3,"MAIN MENU ",(0,0)-(310,180),0,2
- PRINT " Make Your Selections"
- LOCATE 3,1
- PRINT " <F1> to take a Lesson"
- PRINT " <F2> to play a Game"
- PRINT " <F3> to raise the Level"
- PRINT " <F4> to lower the Level"
- PRINT " Press S to start a new run"
- IF FirstStart = 0 THEN PRINT:PRINT " Press <ESC> to Resume "
- IF ModeFlag = 1 THEN Mode$ = "Lesson"
- IF ModeFlag = 2 THEN Mode$ = "Game"
- LOCATE 11,2
- PRINT "Tutor Mode : ";Mode$;" ";
- LOCATE 12,2
- PRINT "Level : ";Level;" ";
- redo: Key$ = INKEY$
- IF Key$ = "" THEN GOTO redo
- Askey% = ASC(Key$)
- IF FirstStart = 0 THEN
- IF Askey% = 27 THEN GOTO CloseMainMenu
- END IF
-
- REM **** check for ascii code of F1 ***
- IF Askey% = 129 THEN
- ModeFlag = 1
- LOCATE 11,2: PRINT "Tutor Mode : Lesson";
- GOTO redo
- END IF
-
- REM *** Check for ascii code of F2 ***
- IF Askey% = 130 THEN
- ModeFlag = 2
- IF Level >= 4 THEN
- Level = 4
- LOCATE 12,2
- PRINT "Level : ";Level;" ";
- END IF
- LOCATE 11,2: PRINT "Tutor Mode : Game ";
- GOTO redo
- END IF
-
- REM **** Check for ascii code of F3 ***
- IF Askey% = 131 THEN
- Level = Level + 1
- IF ModeFlag = 2 THEN
- IF Level >= 4 THEN Level = 4
- END IF
- IF ModeFlag = 1 THEN
- IF Level >= 12 THEN Level = 12
- END IF
- LOCATE 12,2: PRINT "Level : ";Level;" ";
- GOTO redo
- END IF
-
-
- REM *** check for ascii code of F3 ***
- IF Askey% = 132 THEN
- Level = Level - 1
- IF Level <= 1 THEN Level = 1
- LOCATE 12,2: PRINT "Level : ";Level;" ";
- GOTO redo
- END IF
-
- REM **** Don't Start a new game ****
- IF (Askey% <> 83 AND Askey% <> 115) THEN GOTO redo
-
- REM **** Start A New Game ****Redo
- IF ModeFlag = 1 THEN Mode$ = "Lesson"
- IF ModeFlag = 2 THEN Mode$ = "Game"
- LOCATE 15,1
- PRINT "Start ";Mode$;" at Level#";Level;"(Y/N)?"
- Wait5: Resp$ = INKEY$
- IF Resp$ = "" THEN GOTO Wait5
- IF (UCASE$(Resp$)<>"Y" AND UCASE$(Resp$)<>"N") THEN GOTO Wait5
- IF UCASE$(Resp$) = "N" THEN
- LOCATE 15,1
- PRINT " "
- GOTO redo
- END IF
- REM **** Startup Initialization ****
- WINDOW CLOSE 3
- WINDOW OUTPUT 4
- Speed = 800: Wrong = 0: Right = 0: Count = 0
- Reseed = 0: Percent = 0: Points = 0: ActualTime = 0
- GOSUB IScreenFill
- FirstStart = 0 : REM ** Only on initial startup flag
- GOSUB ArrayInitize
- RETURN
-
- CloseMainMenu: WINDOW CLOSE 3
- WINDOW OUTPUT 4
- RETURN
-
- REM ***** Character Array Initialization Routine ****
-
- ArrayInitize:
- REM *** this group of if statements dimensions the array **
- REM *** each level automatically knows how many characters
- REM *** it uses ****
- IF ModeFlag = 1 THEN
- IF Level = 1 THEN MaxChars = 8 : REM *** Lesson 1
- IF Level = 2 THEN MaxChars = 12 : REM *** Lesson 2
- IF Level = 3 THEN MaxChars = 16 : REM *** Lesson 3
- IF Level = 4 THEN MaxChars = 25 : REM *** Lesson 4
- IF Level = 5 THEN MaxChars = 33 : REM *** Lesson 5
- IF Level = 6 THEN MaxChars = 42 : REM *** Lesson 6
- IF Level = 7 THEN MaxChars = 51 : REM *** Lesson 7
- IF Level = 8 THEN MaxChars = 60 : REM *** Lesson 8
- IF Level = 9 THEN MaxChars = 70 : REM *** Lesson 9
- IF Level = 10 THEN MaxChars = 79 : REM *** Lesson 10
- IF Level = 11 THEN MaxChars = 87 : REM *** Lesson 11
- IF Level = 12 THEN MaxChars = 92 : REM *** Lesson 12
- RESTORE Lessons
- END IF
- IF ModeFlag = 2 THEN
- IF Level = 1 THEN MaxChars = 36
- IF Level = 2 THEN MaxChars = 72
- IF Level = 3 THEN MaxChars = 81
- IF Level = 4 THEN MaxChars = 89
- RESTORE LCaseCharacters
- END IF
- MaxChars = MaxChars - 1
- FOR arrayc = 0 TO MaxChars
- READ NextChar$
- Character$(arrayc) = NextChar$
- NEXT arrayc
- RETURN
-
- REM ***** Set the Restore to this label name to take lessons
- REM **** There are 91 chars in all in this data section
- Lessons:
- DATA "a","s","d","f","j","k","l",";" : REM *** Lesson 1
- DATA "e","r","o","h" : REM *** Lesson 2
- DATA "c","t","i","m" : REM *** Lesson 3
- DATA "v",". period","A","S","D","F","E","R","C" : REM *** Lesson 4
- DATA "w","g","n",", comma","' apostrophe","W","G","V" : REM *** Lesson 5
- DATA "J","K","L",": colon","S","b","u","T","I" : REM *** Lesson 6
- DATA "B","U","M","O","H","q","x","p","/ backslash" : REM *** Lesson 7
- DATA "z","y","?","Q","P","X","N","Z","Y" : REM *** Lesson 8
- DATA ">","<","[","]","{","}","3","4","7","8" :REM *** Lesson 9
- DATA "1","2","9","0","#","$","&","*","- hyphen" : REM ** Lesson 10
- DATA "5","6","!","@","(",")","_ underscore","=" : REM *** lesson 11
- DATA "%","^","+","\ slash","| bar" : REM *** Lesson 12
-
- REM ***** Set the RESTORE to this label to do just
- REM **** characters with no shift game.
- LCaseCharacters:
- DATA "a","b","c","d","e","f","g","h","i","j","k","l","m"
- DATA "n","o","p","q","r","s","t","u","v","w","x","y","z"
- DATA "1","2","3","4","5","6","7","8","9","0"
- DATA "A","B","C","D","E","F","G","H","I","J","K","L","M"
- DATA "N","O","P","Q","R","S","T","U","V","W","X","Y","Z"
- DATA "!","@","#","$","%","^","&","*","(",")"
- DATA "- hyphen","=","\ slash","[","]","' apostrophe",", comma"
- DATA ". period","/ backslash"
- DATA "_ underscore","+","| bar","{","}","<",">","?"
-
-
-
- REM ******** Initialization Routine **********
- Initize: REM *** Label ***
- SCREEN 2,320,200,2,1
- WINDOW 4,"Typing Tutor Window",(0,0)-(310,180),16,2
- CLS
- REM ***** disable breaks ***
- BREAK ON
- ON BREAK GOSUB NoBreak
- REM ***** Set up the Palette of colors ***
- PALETTE 0,.73,.73,.67
- PALETTE 1,0,0,0
- PALETTE 2,1,1,1
- PALETTE 3,.4,.6,.93
- RANDOMIZE TIMER
- DIM Character$(256)
- FirstStart = 1: Level = 1: ModeFlag = 1
- GOSUB EraseMenu
- GOSUB Startup
- RETURN
-
- REM ******* Initial ScreenFill Routine *******
- IScreenFill: REM *** label ***
-
- CLS
- LOCATE 2,2 : PRINT "Level: ";Level;" ";
- LOCATE 7,2 : PRINT "TYPE THIS ->"
- LOCATE 10,2 : PRINT "Right : ";Right;" ";
- LOCATE 11,2 : PRINT "Wrong : ";Wrong;" ";
- LOCATE 2,15: PRINT "Points: ";Points;" ";
- LOCATE 15,2: PRINT "Press <ESC> to Pause"
-
- RETURN
-
- REM ***** God said to Abraham, Kill me a Menu *****
- REM ***** Abe said to God where d'ya want this killin' done **
- REM ***** God said out on Highway 61 ******
- REM **** Program Menu *****
-
- EraseMenu:
- MENU 1,0,1," Options "
- MENU 1,1,1," Resume Test in Progress "
- MENU 1,2,1," Start a New Test "
- MENU 1,3,1," Quit this Program "
- MENU 1,0,1,"" : REM *** Remove This Line to Use Menu ****
- MENU 2,0,0,""
- MENU 3,0,0,""
- MENU 4,0,0,""
- RETURN
-
- REM **** NoBreak : The Break Handler ***
- NoBreak:
- BEEP
- RETURN
-
- REM ****** Quitter Cleanup Subroutine *******
-
- Quitter:
-
-
- MENU RESET
- SCREEN CLOSE 2
-
- END
-
- RETURN