TRAIN RACE

by Clyde Bish

from ZX Computing Feb/Mar.1986



Train yourself to be better with the times tables.

Clyde Bish comes to you inter-city from Exeter.





A great program with which to practise your tables, with a

cute line in graphics. The techniques which make this

different from the run of the mill multiplication tester

programs are that the answer is given so the multiplier is

needed, and the time limit for the player is obtained from a

test at the start.



Coupled with Clyde's tight programming techniques and use of

the Horizon "Big Print" routine, all in all a program from

which everyone could learn.



The scenario is a race between two trains to the end of the

track. A correct response moves the player's train (with

appropriate graphic and sound effects). An incorrect one

moves the computer's train. It also incorporates a routine

for testing the speed at which the child can find the key in

question and allows for this in the reaction time thus not

penalising the child who is unfamiliar with the keyboard.

(There must be a few of them still around!)



On LOADing, the title "TRAIN RACE" appears in large letters

(courtesy of Sir Uncle's "Horizons" tape) and a train chugs

and steams across the screen. The friendly computer then

introduces itself, asks the player's name, and explains the

idea of the game, giving a demonstration of what to do.



After checking the time it takes for the child to locate and

press specified keys (this information being used later to

determine the delay time during the game) a choice of

maximum multipliers from 2 to 9 is offered The game is now

ready to begin.



The computer displays a sum with the multiplier missing and

invites the child to press a number key. If the choice is

correct the child's train toots, and chugs on one space. If

the response is incorrect the computer's train moves on. The

game continues until one of the trains reaches the buffers.

If it is the child's train that wins, the machine produces a

musical border effect.



The score is displayed, along with an invitation to play

again with the same or a new player at the same or a

different level.





Entering the program



Firstly, LOAD in the "wall" game from your Horizons tape,

then BREAK and NEW the machine. (Don't panic - you only want

the machine code and that's safe above RAMTOP). Now type in

the listing, but note that the capital letters in quotation

marks in lines 3, 4, 5, 100, 110, 560 (not the word

"WRONG"), 600 (not the word "CORRECT"), 5000, 5050 and 5080

(not the word "CORRECT" are used-defined graphics and must

be entered in the graphics mode.



To SAVE the program use:



SAVE "trainrace" LINE 9999:

SAVE "mc" CODE 32256,300



and verify with:



VERIFY "": VERIFY "" CODE



If you have a printer attached and want a printout of the

child's name, the level, and the score add the line:



1008 LPRINT n$,m' "right";s,"wrong";t''





Figure 1. Line breakdown



Line

3          POKEs Caps Shift followed by the title sequence. During this

           the graphics are set up so as not to produce a noticeable pause

           in the running of the program.

4-5        moves the train across the track.

6          asks for the player's name.

100-110    train draw subroutine.

200-230    train position/colour subroutine.

500-720    main program loop. The computer selects the questions, checks

           the answers, and produces the smoke graphics before calling the

           subroutines above.

1000-1040  end/play again? routine.

3000-3100  large letters subroutine.

5000-5090  instructions and demonstration.

5100-5160  checks speed of key press and sets level of play.

9000-9050  sets up user-defined graphics.

9999       program autoruns to this line, LOADing in the large letters

           machine code from the Horizons tape before starting.





-- end of file --

