TOURIST TRAP - Colin Gooch (ZX Computing-Aug/Sep 83-Page 50)



GET THE HOLIDAY HORRORS IN THIS SPECTACULAR BOARD GAME FOR YOUR 48K SPECTRUM,

WRITTEN FOR US BY COLIN GOOCH OF ILMINSTER.



This is a 'board game' program for two players to play against each other,

rather than one person against the computer. It is a fairly large program

using a major portion of the 48K RAM available on the larger Spectrum. This

means that SAVEing and LOADing will take quite some time. The playing of

one game usually takes something like 40 minutes.

 You can consider the program as operating in four main parts:



1) The initialisation of values and graphics, the printing of the

instructions and then the playing board display.

2) The dice calling routine to decide your throw.

3) The moving of your piece and the diversion if required at that new

position onto a subroutine which will decide your score for that throw.

4) The end game routine.



After the first part has been executed, lines 120 and 130 will keep the pro-

gram looping through the second and third parts, automatically changing the

players, until the end game condition is fulfilled to break out into the

fourth part.



GOING FOURTH



The four sections operate as follows:



PART ONE Lines up to 100 call all the initialisation routines. Line 9000

allows the instructions to be displayed while the user-defined graphics are set

up. These are the two playing pieces, plus a number of odd shaped 'blobs' used

to create pictures in the course of play. The board printout begins at line

8000. The PLOT/DRAW facility draws out a playing track around the outside of

the display area allowing the centre to remain clear for the various graphics

routines. The playing squares are numbered using different combinations of

INK, PAPER and BRIGHTness, these being controlled by the DATA statements at

line 8000. It is the attributes on these squares that will decide the 'fate'

of a player landing on them. It is most important that these are not altered

or you will not be sent to the correct subroutines.

PART TWO The dice routine is a straightforward affair. The variables for the

'pips' are in line 8300 onward and it is printed out as required by GOSUB

8425. To roll the dice you press Enter and keep it pressed until you think you

have the number you want. Removing the pressure will stop the dice.

PART THREE Moving the pieces around the board is more complicated. It is done

by a series of FOR...NEXT statements. These take the value of the dice thrown

as the second control value in the statement and move the piece along that

number of squares. If that line runs out of squares then the next FOR...NEXT

loop will use up the surplus. (I'm usually fond of conditional statements, but

in this case found this system operated in a speedier manner.)

 On arriving at a square, the attributes of the number of that square is read.

If it is 104 then that turn ends, line 6660 changes over the player and your

opponent will have their turn. If it is anything other than 104 then the value

is converted to a GOSUB line and off you go to see what fate is in store.

 The bulk of the program consists of these subroutines which I will let you

discover for yourself. The operation of these routines is fairly straight-

forward. There are nice things that will happen, not so nice things and, of

course, some disasters - all of which lose or gain you points, lose you money

and use up your petrol. If you run out of petrol, you will have to pay for a

rescue and if you are on the way to a location, you will lose the rest of that

turn. The game ends when one person runs out of money...but the winner is the

one with the most points, so towards the end of a game tactics can become

important!

PART FOUR Brief and simple. Once one person is out of money, line 130 fails to

maintain the loop and the 'game over' signal shows. The final scores are then

displayed. The score display routine is at line 8600 and is used at intervals

throughout the game. Line 8610 ensures that petrol and money are only displayed

to two decimal places; without this line you'll find that as the game progresses

you end up with petrol designated in scientific notation!



EASY TO ENTER?



Debugging a program of this size can be a bit daunting and so I would suggest

it is entered in sections. Enter the program as listed but omitting all the

subroutines from line 1000 to 6490. This will allow you to get the board

display and the piece moving routines all in the working order. To do this enter

a temporary line, 6480 RETURN. RUNning the program will then result in every-

thing happening except any of the scoring subroutines. The subroutines can

then be entered one at a time and tested out. There is no need to keep going

round the board to test these, just let the Spectrum print out the board, then

break into the program and type in GOTO (the appropriate routine) and all will

be well. (The 'Press enter to continue' uses the form 'INPUT:LINE Z$' which

means that the usual Break and Stop keys will not work. Never fear. Use Caps

Shift and '6' and you will get a 'stop in input' message.) The 'out of petrol'

routine is the most difficult to test and may best be left until you are happy

with the others.

 Most of the graphics are straight off the keyboard. The only user-defined

graphics that are vital are those for the two players pieces and the dots on

the dice. The others are not so vital but if you enter and RUN line 9000 to

9140 fairly early on, it is easy to see which keys are required.



WE'RE OFF



When all is entered and you are ready to play you will first of all see the

instructions, then the Spectrum will choose at random someone to start. The

board is then printed out; the player whose turn it is will be shown on the

right-hand margin. If you throw the dice and land on a square that is not blue

then some graphics and instructions will appear in the centre of the screen.

To continue to play, simply follow all the prompts. To enter in the spirit of

it all, you must imagine that you are on tour in a car, with a tent, and have

the opportunity to visit various places...wild life parks...castles...the sea

and so on.

 So off you go. Happy holidays.



VARIABLES



The main variables used are:



C(x) Cash on hand.

D    Value of dice throw.

H(x) horizontal position of playing piece.

J(x) Total score.

LO   Flag indicating turn to be lost.

MI   Miles to travel.

P(x) Petrol in gallons.

PL   Player.

SUB  Subroutine in use.

TI   Flag to check the number of times the petrol is evaluated.

V(x) Vertical position of playing piece.

Z$   Line input.



        (x) will be one or two according to value of PL.



The subroutines use many more variables, but they are confined within those

routines and are not difficult to trace through. There are also a number of

DIMensioned strings and variables. These are used in several routines and are

reDIMensioned each time that routine is called.





This info file was typed by Michael Bruhn 13/6-1998

