ZX Computings - OpenLibra
ZX Computings - OpenLibra
ZX Computings - OpenLibra
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
eaten a penalty of 5 moves is<br />
incurred. Numerals 6, 7 or 8<br />
are input as pseudo-cursor<br />
controls to move the insect<br />
down, up, or forwards<br />
respectively. The computer<br />
keeps track of the number of<br />
moves taken to reach column<br />
32 and displays the total at<br />
the end of each game together<br />
with the best performance in<br />
the present series. Pressing<br />
NEWLINE after a game sets up<br />
another game in the same<br />
series. Entering a character<br />
starts a new series.<br />
POKEing<br />
50<br />
2 LET Y = 32000 No. of moves — best so 52<br />
far!<br />
4 INPUT R Seed for random number 54<br />
generator<br />
8 LET P = 0 56<br />
10 LET W = 0 Assign variables prior to 58<br />
PEEK 60<br />
12 LET B = 1 and POKE 62<br />
14 LET A = 8 64<br />
16 LET Z = - 1<br />
18 LET M = 0 66<br />
20 RANDOMISE R Set seed for random<br />
number generator 68<br />
22 FOR N = 1 TO 352 70<br />
24 LET D « 9 72<br />
26 LET X = RNDI2)<br />
28 IF X = 1 THEN LET D = 128 Print eleven lines with 74<br />
30 PRINT CHR$(D); black and grey squares at<br />
random. Pattern 500<br />
determined by R. 510<br />
32 NEXT N 520<br />
34 GOSUB 500 Locate display-file<br />
36 POKE W + 232, 20 Insect in initial position 530<br />
AND FOR<br />
THE '81<br />
While there are many<br />
similarities between the<br />
<strong>ZX</strong>80 and the <strong>ZX</strong>81<br />
in the way the display<br />
is handled, there are some<br />
significant differences.<br />
38 LET Z = Z + 1<br />
40 INPUT C<br />
42 GOSUB 500<br />
44 LET M = W + (A — 1 >" 33 +<br />
B<br />
46 POKE M, 0<br />
48 IFC = 6 and A > 11<br />
ORC = 7 AND A>1 THEN<br />
LET A = A —2*C+ 13<br />
IFC = 8 THEN LET B = 8+1<br />
LET M = W + (A - 1C33 +<br />
B<br />
IF PEEK(M) = 1 28 THEN LET<br />
Z = Z + 5<br />
POKE M, 20<br />
IF B = 32 THEN GOTO 62<br />
GOTO 38<br />
IF Z> Y THEN Y = Z<br />
PRINT "END OF GAME IN<br />
"Z," MOVES"<br />
PRINT "BEST SO FAR", "Y,"<br />
MOVES"<br />
INPUT X$<br />
CLS<br />
IF X$ = " "THEN GOTO 8<br />
RUN<br />
LET P = PEEK(1 6397)<br />
P> 127 THEN LET P = P-256<br />
LET W = PEEK(16396)<br />
4 P* 256<br />
RETURN<br />
Count No. of moves<br />
Which way?<br />
Locate display-file<br />
Th<<br />
adc<br />
CH<br />
dis|<br />
the<br />
Put a space where insect ;inc<br />
Set A and<br />
the<br />
make sure we don't at t<br />
POKE off-screen<br />
can<br />
line<br />
Mev<br />
Set M to next insect<br />
location address<br />
jse<br />
If there's a black square \7~fe<br />
the way, add penalty J)te<br />
Put insect in next locatior -j<br />
Watch for end of game jls<br />
Next move<br />
Set Y to best so far ^<br />
he<br />
x>si<br />
>OK<br />
her<br />
i th<<br />
NEWLINE for another J?®',<br />
game<br />
Any character for anotha^OL<br />
series )3rc<br />
hrec<br />
Subroutine for setting W j<br />
to address of start of rt<br />
display-file<br />
. T<br />
s<br />
P<br />
(f<br />
P<br />
. T<br />
|ai<br />
C<br />
P<<br />
H<br />