This is a simple arcade-style game in which the player manoeuvres a cursor character around the screen to catch a randomly placed alien before a countdown timer expires. The alien (%A, displayed in inverse video as an “A”) is placed at a random row and column using INT(22*RND) and INT(27*RND), while the player’s marker (%+, an inverse “+”) is moved with the keys J, I, M, and K — a common four-direction layout. The score is derived from the remaining loop counter X, counting down from 100, so catching the alien quickly yields a higher score; a high-score variable H is maintained across rounds. The game loop uses CLS on every iteration to redraw the screen, and collision detection is a simple two-step coordinate comparison at lines 170–180.
Program Analysis
Program Structure
The program is organised into a small number of logical phases:
- Title / init (lines 1–5): Displays the title, pauses briefly, and initialises the high-score variable
Hto zero. - Round setup (lines 10–30): Resets the player’s row (
L=10) and column (C=15) to the centre of the screen, then places the alien at a random position (M,N). - Main game loop (lines 50–200): Counts
Xdown from 100 to 1. Each iteration reads a keypress, moves the player cursor, redraws the screen, and checks for a catch. - Failure path (lines 219–230): Prints “LOST” and loops back to a new round.
- Success path (lines 300–310): Updates the high score if appropriate, displays both scores, then falls through to the pause/restart shared at line 220.
Variables
| Variable | Role |
|---|---|
H | High score (persists across rounds) |
L | Player row (0–21) |
C | Player column (0–31) |
M | Alien row (random each round) |
N | Alien column (random each round) |
X | FOR loop counter / score (100→1) |
L$ | Current keypress |
Key BASIC Idioms
- Inverse-video characters as sprites:
%A(inverse “A”) represents the alien and%+(inverse “+”) represents the player. This is a typical ZX81/TS1000 technique for making characters stand out without any separate graphics data. - Countdown loop as timer and score: The
FOR X=100 TO 1 STEP -1loop simultaneously limits round duration and provides the score — the sooner the catch, the larger the remaining value ofX. - INKEY$ polling inside FOR loop: Line 100 reads
INKEY$on every iteration without waiting, giving a near-real-time movement feel, though the loop speed is bounded by the redraw cost ofCLSand twoPRINT ATcalls each cycle. - Two-condition collision detection (lines 170–180): Row and column matches are checked in sequence. Line 170 uses
IF L<>M THEN GOTO 200to skip the column check entirely when the row does not match, avoiding a compound condition.
Movement and Controls
Four keys provide cardinal movement using a layout common on rubber-key machines:
| Key | Effect |
|---|---|
I | Up (decrement row L) |
M | Down (increment row L) |
J | Left (decrement column C) |
K | Right (increment column C) |
Bugs and Anomalies
- No boundary clamping:
LandCare never checked against screen edges. Moving the player off the 22×32 display area will cause an “Out of screen” error and crash the program. - Alien not erased on miss: Because the alien is drawn once at line 60 (inside the loop) and
CLSis called at line 150, the alien is actually redrawn every iteration — this works correctly, but it means the alien always appears at the fixed position drawn before the loop, and any flickering is inherent to the CLS-then-redraw cycle. - Line 60 is inside the FOR loop but the alien position is fixed:
MandNare not updated inside the loop, so the alien does not move; it is simply redrawn at the same spot each frame, which is the intended behaviour. - High-score condition uses
IF H<X: This correctly updatesHonly when the current score exceeds it. - Lines 320–330: These are utility/maintenance lines (SAVE and RUN) that are unreachable during normal program execution and do not affect gameplay.
Content
Source Code
1 PRINT AT 0,12;"CATCH THE ALIEN"
2 PAUSE 300
4 REM % %C%A%T%C%H% %T%H%E% %A%L%I%E%N%
5 LET H=0
10 LET L=10
20 LET C=15
25 LET M=INT (22*RND)
30 LET N=INT (27*RND)
50 FOR X=100 TO 1 STEP -1
60 PRINT AT M,N;"%A"
100 LET L$=INKEY$
110 IF L$="J" THEN LET C=C-1
120 IF L$="M" THEN LET L=L+1
130 IF L$="I" THEN LET L=L-1
140 IF L$="K" THEN LET C=C+1
150 CLS
160 PRINT AT L,C;"%+"
170 IF L<>M THEN GOTO 200
180 IF C=N THEN GOTO 300
200 NEXT X
219 PRINT "LOST"
220 PAUSE 500
230 GOTO 25
300 IF H<X THEN LET H=X
305 PRINT AT 1,1;"YOU SCORED ";X;" HI SCORE ";H
310 GOTO 220
320 SAVE "1015%6"
330 RUN
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.
