ZX Computing Dec 1982/Jan 1983 p13

A Pair of Zippy Road Runners
EXECUTION (16K ZX81)		by Paul Toland
KLINGON CAPTURE
MAZE MAN			by Tudor Costigan
Mine Field (Skilful Driving)	by Paul Toland, Derry
Snakes (Reptile)		by Paul Toland, Derry
Splodgies from Space		by Paul Toland, Derry
EXECUTION			by Paul Toland
ANAGRAMS			by Paul Toland
CRASHER				by Dilwyn Jones
LIFE IN MACHINE CODE		by K B Cusson



A Pair of Zippy Road Runners

ZX81 programs often run, just as they are, when typed into a Spectrum. But
usually the effort of adding a little colour and sound is worthwhile.

For this article, Tim Hartnell wrote a ZX81 "car driving" program in which
you can use the "Z" and "M" keys to drive it down a twisting, turning track;
and then decided to convert the game for the Spectrum. You might like to run
Tim's versions first and then work out your own variations.

Submission notes -

included:
- Road Runner for ZX81
- Original Road Runner for Spectrum (Run or Goto 0 to start)
- Improved Road Runner for Spectrum

For the improved version I have changed the keys from 'Z' and 'M' to the much
friendlier 'z' and 'm' which don't need you to hold down Caps Shift to play
the game. I've also added a restart-on-keypress to save having to continually
break and re-run. I've left the slightly dodgy collision detection which lets
you sideswipe the scenery as long as you don't run into it.

Andy Krouwel
22nd March 2004


======================================================================



EXECUTION (16K ZX81)
by Paul Toland
from ZX Computing (December 1982/January 1983),pages 91-92

This is a graphic variation on the hangman game. The computer chooses a
word randomly from its vocabulary, and you have to guess what the word is,
by entering letters one at a time.

You're allowed 20 incorrect guesses before the blade on the guillotine does
its job. there is no need to press NEWLINE when entering guesses.

Before you run the program the first time, enter DIM D$(30,10) as a direct
command, then start it with GOTO 1 (not RUN). Then, you'll be asked to
enter 30 words, one at a time. For subsequent runs, start with GOTO 5, and
your vocabulary will be safe. Enter "N" if you do not want anotehr game at
the end. SAVE the program by entering GOTO 390.



KLINGON CAPTURE
---------------
A Klingon ship is hiding behind one of 100 stars. You must try and trap the
Klingon by shooting the eight surrounding squares, without hitting the
Klingon. He must be taken alive.
The display tells you where the Klingon was one move ago. This may or may not
be his present position, as he could have moved.
The Klingon decides to move in one of nine ways. He may move to one of the
eight surrounding squares, or he may stop still. The probabilities of these
actions are equal. If the square it wishes to move to is clear, then it will
move there, and the square it vacates will be shown as the "last position" on
the display.
If the square it wishes to move to has already been blasted away, it will
remain in the same square.
When shooting, enter the horizontal co-ordinate, followed by the vertical one.


======================================================================


MAZE MAN
--------
by Tudor Costigan
from ZX Computing Dec'82/Jan'83

Getting stuck into the maze

From deepest Gloucestershire (Cheltenham, in fact), Tudor Costigan conjures
up a maze, and puts you in control of MAZE-MAN.


The program is easy to understand once you press RUN. You press 'a' to move
up, 'z' to move down (the funny blob in line 320 of the instructions is a z),
'm' to move right and 'n' to move left. The reason for choosing three keys
will become clear when you try the program out.

You get 100 points for an 'o' and 200 points for an exclamation mark, with a
miserable 10 for an asterisk.

Program description

0010-0070: Initialisation of variables and the like. POKE 23692,255 cures the
Spectrum of its habit of asking "Scroll?" every time you blink. The
subroutine at line 4300 draws the design shown at the beginning of the
program.

0090-0185: These print the title and ask for the "skill level", with suitable
error messages. 'ww' is used as a delay loop later in the program.

0190-0210: These define the user graphics, using DATA statements from lines
3700 onwards. In the listing, the graphics are shown as the letter they are,
rather than the little things you'll have flashing around your screen when it
gets underway.

0230-0440: This section of the program provides instructions if they are
needed.

0510-1630: These set up the position of the "ghost" in 'l' and 'k', and then
print out the board. Originally, when Tudor first wrote this, each "character
position" of the board had a different DATA element, but he found this too
slow. Tudor says that the design of the board has been "extensively tested"
at his school, and there have been no complaints! You can make the elements
of the lines different colours, puting the colours directly into the DATA
statements, as described in your manual. The CHR$ 17; CHR$ 8 in line 1420
allows the old attributes of the paper to show through (see your manual,
pages 111 and 114). Lines 1550 to 1610 print the title and scores in varying
degrees of noticeability. Line 1620 prints the amount of man left in the
middle of the board. Line 1630 sets the paper colour to green, the background
colour of the insides of the maze.

Variables used:

n    - high score
n$   - high score
j    - code of object "underneath" ghost
kk   - number of lives left
i    - to count objects eaten this "frame"
b    - score
d$   - stores previous key pressed
v    - loop variable
c$   - general input variable
q,z  - loop variables
d    - loop variable
a$   -  stores data for board printer
s    - loop variable
x,y  - position of maze man
k,l  - position of ghost
ss,sd- contents of proposed position
q$   - score and colour control
aa,bb,cc,dd - length of notes
qa,qb-added to k and l produce old position


======================================================================


Mine Field (Skilful Driving) [Paul Toland, Derry]

"The minefield is full of casualties, and you have
to push a wheelchair around the minefield, avoiding
the mines and the electrified fence, collect each
casualty and bring him or her to the hospital (the
flashing +). Note that the wheelchair can only carry
one person at a time. What a wonderful scenario for
a game."

ZX COMPUTING; DEC 82/JAN 83, p97


======================================================================


Snakes (Reptile) [Paul Toland, Derry]

"In this program you must try to grow your snake
as long as possible, by directing it to the pound
signs which it eats. However, the 's remain on the
screen for only a short time, after which they turn
into poisonous dollar signs (sorry 'bout that, Mr
Reagan). The snake will also die if it hits the
surrounding border or itself. Once the game is over,
you'll be told how long you became."

ZX COMPUTING; DEC 82/JAN 83, pp95-96



======================================================================


Splodgies from Space [Paul Toland, Derry]

"Your job is to protect the Earth from marauding
Splodgies, which come from the planet Epsilon IV.
The Terran Shield, which protects we poor Earthlings
from such horrors as the Splodgies, has developed a
weak spot, and the Epsilonian Mother Ship is hovering
just above it."

"You must stop the Splodgies landing and hitting the
shield by getting your ship underneath them. If part
of the shield is hit, then it will weaken."

"If a weak spot is hit, then the shield will collapse,
and leave the Earth open to attack. You can restore
a weak spot by moving your ship over to the spot and
pressing 'F'."

ZX COMPUTING; DEC 82/JAN 83, pp96-97


======================================================================
Starting off at the sharp end

EXECUTION and ANAGRAMS are two great word games written by Paul Toland for
the 16K ZX81. If you haven't got a 16K pack, there's no need to feel left
out, as Dilwyn Jones game CRASHER fits happily within 1K.


Execution
This is a graphic variation on the hangman game. The computer chooses a word
randomly from its vocabulary, and you have to guess what the word is, by
entering letters one at a time.
  You're allowed 10 incorrect guesses before the blade on the guillotine does
its job. There is no need to press NEWLINE when entering guesses.
  Before you run the program the first time, enter DIM D$(30,10) as a direct
command, then start it with GOTO 1 (not RUN). Then, you'll be asked to
enter 30 words, one at a time. For subsequent runs, start with GOTO 5, and
your vocabulary will be safe. Enter 'N' if you do not want another game at
the end. SAVE the program by entering GOTO 390. Note that the inverse E in
line 390 should be entered as an ordinary E.


Anagrams
The ZX81 randomly selects and scrambles a word. You must repeatedly enter
what you think is the correct word, and the computer will underline those
letters which are in the correct position.
  You have a maximum number of attempts before the computer stops you and
reveals the word. You use 'N' if you don't want another game, or just press
NEWLINE/ENTER if you do.
  Entering the initial vocabulary, and the subsequent changing of it, is the
same as in Execution. Save the program by entering GOTO 340, and restart the
program without losing your vocabulary, by entering GOTO 10. You'll need to
set up an array, by entering DIM D$(30,10) in the direct mode before you
begin, then start with GOTO 1.
  It takes some time to scramble a word, so don't be surprised if nothing
happens for the first few seconds of the game.


Crasher
Nothing to do with some computers' habits of blanking out! You are drifting in
space, the object being to clear up as much debris as you can, particularly
those with a high CODE value. The debris is valued according to the code of
the character of debris. The letters score highest, then numbers and so on.
Ignore inverse characters if they appear for they do not score because
they've been affected by solar radiation and mutated to their inverse form,
so are not worth anything. The keys 5 and 8 steer you left and right in the
direction of the arrows on the keys. You score when the debris is directly
ahead of you on screen so you "crash" into it. The position of your spaceship
on screen is set by X (horizontal position) and Y (vertical position). They
are initially set by lines 10 and 20 to a position at about the middle of the
playing area of the screen. The variable S records your score and is set to 0
at the start of the game by line 30. F is the variable that controls the
duration of the game  it does not count in any particular unit but is a
convenient way of controlling the length of the game. The time is clocked up
in line 50, one unit of space-time at a time (!) The statement LET F=F+1
may confuse you a little since it is hard to imagine F being equal to F+1.

Truth
It actually means add 1 to the old value of F to make the new value. Line 60
is rather complicated. It determines where the character is PRINTed, which
character is PRINTed and whether it's an inverse character. Let us look at
the position first. The character is placed at the bottom of the playing area;
the V co-ordinate is set at 20 and X co-ordinate to a value from 0 to 19 by
the random number expression. The expression after the semi-colon generates a
character at random from the number generated in brackets after CHR$. The
number generated is a random number from 1 to 63. The following expression
may look rather strange, but all it does is determine whether to add 0 or 128
to this number (ie. determine whether the character generated is inverse or
not). It is a special use of the function AND. What it does is look at the
following expression, add 0 to the value if it is not true, or the value
before AND if it is true, so that 128 is added to the random number only if
RND is less than .2. This makes it roughly a one in five chance of the
character being an inverse, non-scoring character. The statement after this
erases the old position of the V before it is scrolled up the screen by line
70. This ensures the V is not PRINTed anywhere other than the middle of the
screen. Line 80 checks the keyboard to see whether you're steering to the
left, right, or keeping it stationary, and changes the value of X accordingly.

Printing and Rushing
The V is PRINTed in its new position in line 90. You can see how the effect
given is that the spaceship (V) remains stationary while space seems to rush
past. The second part of line 90 moves the PRINT position to immediately
ahead of the position of the spaceship. Therefore we may find what is
immediately in front of the spaceship by means of the line 100, which finds
the CODE of the character stored at that memory location by PEEKing the
address held in the system variables 16398 and 16399. Line 110 checks to see
if this character ahead of the spaceship by means of the line; ie. it has a
CODE of less than 64 rather than less than 128 as you might expect from an
inverse character detector. This would permit CHR$ 118 NEWLINE markers that
SCROLL might push up the screen. You may like to add this line which will
stop the program if you hit a radiation-mutated piece of debris:
	115 IF P>127 THEN STOP




LIFE IN MACHINE CODE
by K B Cusson
from ZX Computing Dec'82/Jan'83 (p.22)

In the last issue of ZX COMPUTING we discussed John Conway's game of LIFE, and
gave a sample program in BASIC to run the LIFE process, From Epsom, K B Cusson
has sent us a fine program to run LIFE in machine code. The speed of this
program is most impressive, as are the results.

Most computer enthusiasts will have either played or heard of the game of LIFE.
its one of those classic games which refuses to die out. Part of its lasting
appeal lies in the fact that it is a creative game. as opposed to destructive
games in the Space Invaders category. Unfortunately. most versions of LIFE are
written in BASIC, which makes them very slow-running. and detracts greatly from
their interest. In an attempt to overcame this, a reduced screen area is often
used, which also detracts from the game. The version presented here uses a
central 0.5K machine code routine, and is capable of running at two generations
per second using the whole screen.

The Rules

Life is supposed to simulate the growth, survival or death of a ((rather
stylised) colony of living cells. Each character position on the screen can be
occupied by a single cell (represented by O) or be vacant. It a living cell has
less than two, or more than three. neighbouring cells it will die in the next
generation. If a vacant space is surrounded by exactly three live neighbours a
new live cell will be created there next generation.

To start things off an initial colony pattern is loaded by hand, or
alternatively a random loading routine can he used.

Facilities

1) A variable delay at 0 to 64 seconds can be set between
    generations to allow more time to study interesting
    developments.
2) The game can be halted indefinitely between generations
    then restarted when desired.
3) The game can be stopped and a colony pattern edited
    manually, then restarted.
4) Six strings are available for the storage of patterns. These
    are numbered 1 to 6 and can be loaded with a current pattern at
    any stage as desired. In addition, string no. 6 is automatically
    loaded whenever the display is edited or an initial colony loaded.

Playing LIFE

Instructions are contained within the program. and these are reasonably
self-explanatory, but a few points deserve emphasis. The game is menu driven,
various option tables and instructions appearing as you proceed. Once the
machine code section is entered, however, these disappear to be replaced by the
colony pattern. Should you forget any of the control keys at this stage, the
initial option page can always be recalled by pressing R.

Although the screen is two dimensional, it represents a spherical surface for
the purposes of LIFE, ie the top line is considered to be adjacent to the
bottom line, and the LHS and RHS columns are considered adjacent when deciding
what the pattern of the next generation should be. This means that you are
quite likely to see patterns disappearing off one side of the screen and
reappearing at the other.

When loading start patterns by hand it is usually best to choose very simple
ones, since they are easy to load and some of them will produce amazing results.



