CAR MAZE

The following game is more a test of rapid thinking than a game of strategy or tactics; you have to drive a car throuqh a maze, which moves steadily up the screen. The maze is randomly generated, but there is always a safe path if you can find it in time. You have controls to move the car forwards down the screen, and to the left or right. If you collide with one of the walls you must start again! To make the game even more difficult the maze moves progressively faster as the game proceeds.


BBC Computer Version

The BBC version uses the following controls:

Z - move left X - move right / - move forwards

5 REM ... Car Maze ...
10 H=0:I=6:L=40
12 L%=-226:R%=-195:D%=-233 
15 MODE7:VDU28,0,24,39,0

Set up strings for walls.

20 DIM W$(5)
22 WS(0)=" *	     *         *         *       "
23 W$(1)="      *         *         *         *  "
24 W$(2)=" *    ******    *    ******    *    *  "
25 W$(3)=" ******    ******    ******    ******  "
26 W$(4)=" *    ******    ******    ******    *  "
27 W$(5)=" *    *    ******    *    *    *    *  "

Start of main loop here; start car off on line 24 in column 20.

30 REPEAT CLS:PRINTTAB(0,24);
35 Y=20:@%=6:G=0:E=200:V=0
40 X=&7FCO:B=X
50 IFY?X<>32 GOTO 200
60 Y?X=&7F:FOR J=0TO E:NEXT
61 IF G AND 1 GOTO 100
62 PRINT CHR$(10);:X=X-L
63 IF V=0 C=RND(4)+1: D=RND(2)-1:$B=W$(C):V=4:GOTO 100
65 $B=W$(D):V=V-1
100 B?39=32:G=G+1:IFE>0 E=E-1
105 Y?X=32

Look for keys; Left decreases Y, Right increases Y, and Down adds L to X.

110 IF INKEY(L%) Y=(Y+39)MOD 40
120 IF INKEY(R%) Y=(Y+1)PKD 40 
130 IF NOT INKEY(D%) GOT050 
140 IFY?X<>32 GOTO 200
150 IFX<B X=X+L
160 GOTO 50

Crash - bleep, and put up score. Wait for space to play again.

200 Y?X=152:PRINT CHR$(7);CHR$(30);"Score",G,"       Highscore",H:IF G>H H=G
220 REPEAT UNTIL GET$=""
230 UNTIL 0

Variables:

@ - Numerical field width
B - Address of bottom line of screen
D% - Number of / key
E - Speed. E=0 is maximum speed
G - Score
H - Highest score
I - Number of different walls
J - Delay counter
K - Key typed
L - Screen width
L% - Number of Z key
R% - Number of X key
V - Counter for vertical walls
W$(0)..W$(4) - Strings containing walls
X - Address of start of line containing car
Y - Position of car across screen

Atom Version

The version for the Atom uses the following keys, which can be read easily from a BASIC program:

SHIFT - move left
REPT  - move right 
CTRL  - move forwards
5 REM ... CAR MAZE ...
10 H=0;I=6;L=32

Set up strings for walls.

20 DIM W(I*L)
22 $W=    " *         *         *         *"
23 $W+ 32="      *         *         *     "
25 $W+ 96=" ******    ******    ******     "
24 $W+ 64="      ******    *    ******     "
26 $W+128=" *    ******    ******    ******"
27 $W+160=" *    *    ******    *    *    *"
28 FORN=0TO L*I;IF W?N=#2A W?N=#FF 29 NEXT

Start of main loop here; start car off on line 24 in column 20.

30sPRINT$12;?#E1=0;PRINT'''''''''''''''
35 Y=16;@=6;G=0;E=200;V=0
40 X=#81E0;B=#81E0
50zIFY?X<>L GOTO x
60 Y?X=160;F0R J=0TO E;NEXT
61 IF G&1 GOTO v
62 PRINT$10;X=X-L
63 IF V=0 C=ABSRND%4+2; D=ABSRND%2;$B=$(W+C*L);V=4; GOTO v
65 $B=$(W+D*L);V=V-1
100v?#81FF=L;G=G+1;IFE>0E=E-1
105 Y?X=L

Look for keys; Left decreases Y, Right ancreases Y, and Down adds L to X.

110 IF?#B001<128 Y=(Y-1)&3l 
120 IF?#B002&#40=0 Y=(Y+1)&31 
130 IF?#B001&#40<>0 GOTO z
140 IFY?X<>L GOTO x
150 IFX<B X=X+L
160 GOTO z

Crash - bleep, and put up score. Wait for space to play again.

200xY?X=152;PRINT$7$30"score"G"   highscore"H;IF G>H H=G
210 LINK#FFE3;GOTO s

Variables:

@ - Numerical field width
B - Address of bottom line of screen
E - Speed. E=0 is maximum speed
G - Score
H - Highest score
I - Number of different walls
J - Delay counter
L - Screen width
V - Counter for vertical walls
W - String containing walls. $(W+C*L) is wall C
X - Address of start of line containing car
Y - Position of car across screen