3D MAZE
-------
An explosive 9K program for the ZX80,
courtesy of Mike Hyams of Middlesex.


The plot for this game is that you are a member of a bomb disposal squad and
information has led to the suspicion that a bomb has been hidden somewhere in
the corridors of a building.

You decide the size of the building you are to enter, but if you're not
feeling too confident then you may think twice before asking the computer for
the maximum size of a 15 by nine maze.

Once you have decided on the size of maze you require, the floor plan of the
building will be shown to you for a period of time (the length of time the
floor plan is shown to you depends on the complexity of the corridors). You
will find there is only one way through the maze and you must be quick about
finding it and then committing it to memory.

If you don't manage to find the bomb (represented by an '0' character) in
time, the bomb will explode and you with it. You are represented by an
asterisk. Should you get hopelessly lost you can always type 'H' and you will
be shown the floor plan again and your position, but this will cost you
valuable time.

Notes on the program

The machine code routines in lines 10 and 12 are a PAUSE routine. The machine
code routine in line 14 stores and retrieves the maze plan in a high memory
location. All the 1s and 0s are numbers and not letters  it is important
that these are entered correctly.

When the program is RUN, there is a short wait while the above machine code
is LOADed into the memory.

Lost?

According to how large you specify the maze, there will be a time limit set
which takes the size of the maze into account giving you a specific number of
moves to find and defuse the bomb. Each time you ask for help 10 points are
deducted from this count so you see how important it is to look very
carefully at the floor plan when you start.

To see how much time you have left, you could always enter the following line:

755 PRINT "MOVES LEFT?";H*W*8/10-GOES

A last word  if you do run out of time, the screen will go berserk for a
couple of seconds. This is not a fault in the program  what else would you
expect to happen when a bomb goes off?




Frustration
by Mike Whitcombe
from ZX Computing 8310p83

Don't 'lose your cool' in this program from Mike Whitcombe of Havant.

Frustration is a game for the 16K ZX81 - the reason for its name may become
clear as you play the game!

The object of the game is to place a flashing pixel on the target pixel which
sits in one of the corners of the screen and to do so in the least number of
moves. The game is played four times in all with some added difficulty each
time. the keys, 5 to 8, control the direction in which the pixel moves.
Pressing 'C' will clear away the trail left by the moving dot and is useful if
the screen becomes too confusing.

In the first game. the target dot stays in the top left-hand corner of the
screen, but in subsequent games it moves randomly between the four corners of
the screen. The third and fourth games are played against a half-blacked or
completely blacked background.

Good luck and have fun!





SPIDER
by Nicholas Wilding
from ZX Computing Oct/Nov.1983

SPIDER'S WEB

Find your way to freedom in this challenging program from Nicholas Wilding of
Henley-on-Thames.


This game occupies just over 8K of memory, and is made up of three games which
are inter-related. You are a common household spider whose task is to escape
from the bathroom to freedom.

When you RUN the program you will have a chance to see the instructions, but in
order to understand the aims of each game, here follow some details that you
might find helpful.


Stage direction

Game 1 - Two deadly drips are forever destined to fall down the plughole from
which you are trying to escape. You must avoid these drips by sheltering in the
hideouts which are randomly situated in the pipe. In order to progress up the
plughole you have to emerge from these hideouts. As you enter each one of the
five new screens of plughole you encounter, your starting position will always
be safe.

Game 2 - By swinging on your web, you can avoid the obstacles both one and two
squares below the spider's eyes to reach the bathroom floor.

Game 3 - The third game gives the spider a chance for the final escape. In
order to exit by the bathroom door (a graphic 'D') the spider must avoid
obstacles in its path.

The spider may collect up to three of these obstacles without losing a life.
However, it is best to avoid them for if the bathroom door can no longer be
seen (ie. it is closed) the spider will need to collect an extra obstacle to
re-open it. If you have already collected three obstacles, you will lose a
life; you are allowed three lives only.

To reach Game 2, Game 1 has to be mastered, and to reach Game 3, both preceding
games must be completed.


Program description

Here follows an explanation as to how the program works:

Lines 10-70     Ask if instructions are needed (line 15) and set
                up the variables needed for Game 1.
Line 100        Prints the spider (S$).
Lines 110-150   Move the drips down one square, and check
                whether the spider has been hit.
Line 160        Checks to see if the spider has completed a
                screen of the plughole.
Lines 165-210   Move the spider if a key has been pressed.
Lines 1000-1090 Draw a screen of the plughole.
Lines 1100-1160 Set up the co-ordinates of the two drops.
Lines 2000-2030 Inform you that you have been killed. An
                endless loop.
Lines 3000-3170 Congratulate you on completing the first stage
                of the game, and ask if you wish to continue -
                if not the program ends in an endless loop
                (lines 3160 and 3170).
Lines 4000-4030 Initialise the variables used in Game 2.
Lines 4100-4160 Form the main Game 2 loop.
Lines 4415-4570 Swing the spider across the screen if required.
Lines 5000-5020 Make the words and score fit with the 'doom
                message' in lines 2000 to 2030.
Lines 5100-5199 Congratulate the player on completing Game
                2 and introduce you to Game 3.
Lines 5200-5298 Draw the screen border for Game 3.
Lines 5300-5385 Print more obstacles on the screen.
Lines 5400-5490 Print the spider on the screen and check if it
                has bumped into a graphic character (bath-
                room obstacle).
Lines 5500-5595 Inform you that you are lumbered with another
                obstacle and print another door on the screen.
Lines 5600-5610 Form an.endless loop telling you that you're
                dead.
Lines 5700-6150 Draw the 3D bathroom door and make the
                spider walk out.
Lines 7000-7700 Form the instructions.
Lines 9980-9990 Make the program self-RUN. (When SAVEing
                the program, type GOTO 9980.)


--
Another Fine Product transcribed by:
Jim Grimwood (jg27paw4@globalnet.co.uk), Weardale, England
--





TOWERS OF HANOI
by G Jackson
from ZX Computing Oct/Nov.1983

The ZX81 solution to this age-old puzzler, courtesy of G Jackson of Cardiff.


This program will help you solve the Towers of Hanoi problem. This involves a
number of rings of different sizes which are stacked on Tower 1 in a similar
way to that shown in Fig.1. The idea of the problem is to eventually stack the
rings on Tower 2 or Tower 3 so that at no time does a larger ring rest on a
smaller one.


A bit steep?

The driving force of the program is the recursive subroutine (one which calls
itself) at lines 50 to 104. The program enters the subroutine with N (the
number of rings in play) and breaks out at line 82 with P (the tower number -
1, 2 or 3) from which the ring is to move, Q (the number of the 'goto' tower)
and N (one less than the number of the moving ring - ring 1 being the
smallest). After display of the move, the routine is re-entered at line 84 for
the next instruction and then circulates between lines 70 to 104 until the
problem is solved. The program finally RETURNs to line 60 to show the number of
moves made (always 2^N - 1, where N is the number of rings) and to wait for key
'P' at line 64.

The recursive subroutine can be modified to run on its own. First, you should
add the following line:

49 INPUT N

where N represents the number of rings. Then, replace lines 60 to 68 with:

60 STOP

Finally, replace lines 82 to 84 with the following line:

82 PRINT "RING";N+1;" FROM TOWER";P;" TO TOWER";Q

Then, RUN 49 and enter your value for N.

The action of the routine can be followed through, for N=3 for example, if it
is remembered that GOSUB puts its RETURN address (the following line) onto the
GOSUB stack and each RETURN removes an address (last in - first out) and goes
to it.


Start here ...

For newcomers to the ZX81, the following notes may prove of interest

Lines 40 to 46 produce a number of nine character rings, all PRINTed at column
zero; their middle characters form the centre of Tower 1 at column four. The
tops of the towers (usually invisible!) are all on screen line five.

At lines 108 to 124, the P and Q values (1, 2 or 3) from line 82 are converted
to 0, 9 or 18, and are assigned to GF and GT as the PRINT AT column numbers for
the 'go from' and 'go to' towers respectively.

The character, R$(N+1), of the ring tb be moved is given by N from line 82, but
its line number and the height to which it must be raised are found by PEEKing
the towers. This requires the display file reference address, D, which is the
central top of Tower 1. (Try adding a line 49 POKE D,23.) The D file addresses
of the tops of Tower 2 and 3 are therefore D+9 and D+18, so a ring at three
lines below the top of Tower 2 will have its centre at address D+9+99 and will
be found by PEEK (D+T), where T has the value of 108. In that case, the
sub-routine at lines 166 to 174 will RETURN to lines 114 or 124 with TT=9 and
T=108 and assign value 8 to the PRINT AT line number variable X or Y. The
difference between eight and three is explained by the tower tops being on
screen line five.

The 'other' tower need not be PEEKed; the line number of its upper ring, Z, can
be calculated because the total of lines from the tower tops to the upper rings
on all three towers is always twice the number of rings in play. Therefore, X-5
+ Y-5 + Z-5 = 2xN1 (check out lines 34 and 128).


High times

It will be seen that X, Y and Z are inverse measures of the heights of the
piles of rings on the 'go from', 'go to' and other tower respectively.

ABS(GF-GT)=18 means that the 'go from' and 'go to' towers are 18 columns apart,
so that the other tower is between them. If the height of its pile is greater
than that of the 'go to' tower, ie. Z is less than Y, then the lift (if any) of
the moving ring must be determined by Z and not Z - hence lines 134 to 136.

Programs with subroutines may suffer from lack of memory if they are frequently
interrupted before all the GOSUBs have returned; useless return addresses
accumulate in the GOSUB stack, causing it to go down in memory which may be
required by the program itself. The effect of this is perpetuated when the
program is SAVEd.

In this program, the stack can be cleared in the following way. First add the
following line:

59 RUN 81

Then, add the following two lines:

61 PRINT AT 14,0;PEEK 16386 + 256*PEEK 16387
81 PRINT AT 14,0;PEEK 16386 + 256*PEEK 16387

Finally, change line 82 to read:

82 RETURN

Repeat the command, RETURN, until the error report shows T/82. Lines 61 and 81
are optional - they show the changes of the addresses of the GOSUB stack (it is
32764 when cleared). Don't forget to remove line 59 and restore line 82 before
trying the game again though!


--
Another Fine Product transcribed by:
Jim Grimwood (jg27paw4@globalnet.co.uk), Weardale, England
--





CRAZY BALLOON
by Jeremy Lever
from ZX Computing Oct/Nov.1983

CRAZY BALLOONING

Take part in an aerial assault course in this program
written for us by Jeremy Lever of Douglas, Isle of Man.


This is an adaptation of the popular arcade game for the ZX81. You have to
guide the balloon around the course of prickly asterisks to reach the area
marked 'GOAL' in the top left-hand corner of the maze.

You start at the bottom right-hand corner of the course and the controls you
should use to guide your balloon are shown in Fig.1. Obviously, the idea of the
game is to try and get your balloon to the goal without it hitting the
asterisks which, in case you couldn't guess, burst your bubble!

You can always take a short cut through one of the two gates in the asterisk
wall - but take care, this is not always the easiest route!


Program description

Below is a brief breakdown of the program.

Lines 1-85      Initialisation.
Lines 90-185    What key has been pressed?
Lines 193-240   What has the balloon hit?
Lines 255-300   Swing routine.
Lines 400-520   The 'balloon burst' and 'high score' routines.
Lines 550-570   The goal routine.
Lines 600-620   The bounce at the start of the game.
Lines 1000-1250 The routine to set up the screen.
Lines 2000-2200 The routine containing the instructions.
Lines 3000-3320 The movement routine.


--
Another Fine Product transcribed by:
Jim Grimwood (jg27paw4@globalnet.co.uk), Weardale, England
--





ZX MISSION
by Adam Freed & Steve Hackett
from ZX Computing Oct/Nov.1983

MISSION

Try and infiltrate the enemy's base with Adam Freed and Steve Hackett of Bognor
Regis.


In this game for the 16K ZX81, you pose as a soldier behind enemy lines and
your mission (should you decide to accept it) is to get into the secret base at
the top of the screen.

The secret base is placed behind a grey wall and looks fairly easy to reach,
apart from the fact that the enemy are on your tail. You are represented by a
cross and you get to move ten spaces at a time. Your moves can be either North,
South, East or West and these are carried out through the use of the 'N', 'S',
'E' or 'W' keys.

Once you have made your move, the computer decides the enemy 'planes bombing
route. Fortunately for you, their aircraft are not equipped with radar, but
they do know your previous position. However, as you make more moves, the
bombing becomes more intense - this is controlled by the value of the variable
O, in line 1009.


Program description

Here follows a brief description of the program:

Lines 1-600     Set the variables, print the screen display and
                cater for your moves.
Lines 1000-1120 Make the enemy bombing moves.
Lines 2000-2090 Increase your score and the number of bombs dropped
                as your character gets nearer to the grey wall.
Lines 4000-4030 These lines tell you that you have used up all
                the moves you can make this turn.
Lines 6000-6040 This routine controls you getting bombed.
Lines 6041-6120 This is the 'high score' routine and controls the
                offer of another game.
Lines 9000-9060	These lines contain the on-screen instructions.


--
Another Fine Product transcribed by:
Jim Grimwood (jg27paw4@globalnet.co.uk), Weardale, England
--





DROP-OUT
by S.P. Stratford
from ZX Computing Oct/Nov.1983

SP Stratford of Hemel Hempstead presents us
with a ZX81 version of the popular arcade game.


This is a game for the ZX81 with at least 3.5 K of RAM and has been written so
that, apart from the enjoyment I hope you'll get from the game, you will also
learn more about the capabilities of the computer.

The idea of the game is to drop your arrow, a 'V', into the mouth of a bottle.
If you miss the mouth of the bottle or land in one of the other bottles, you
score the amount of points indicated at the bottom of the bottle (printed in
inverse print). You have ten attempts to score as many points as possible, and
you lose one of your goes for each 'V' dropped. To drop a 'V', press any key
apart from Break or Shift.


Gotta lotta bottle

When the program is RUN, the bottles appear and your '>' moves rapidly across
the screen. Pressing a key will make your arrow fall from its path, hopefully
into the mouth of a bottle. When your ten attempts have been exhausted, your
score and the highest score so far will be displayed.

The program uses the memory mapped display of the ZX81 with at least 3.5K. I
have deliberately not included instructions in my program so that users with
more than 1K but less than 1 6K can also enjoy the game.

I have used variables to represent areas of the program, for example:

70 GOSUB DRAWG

This line makes the program go to the subroutine to print the bottles.


Outline

Here follows a brief explanation of some of the more important lines of the
program:

5	- Initialises the main variables used in the program.
10	- Finds the beginning of the display file.
20	- The starting position of your arrow character.
210-230	- The routine to find out if your arrow has hit anything.
280	- The routine to print on the screen how much you scored.
710	- Prints your points on the screen.

If the user wishes to have a delay before the game starts, they should add the
line:

7 PAUSE 4E4

Then, by pressing a key, the game will start. When the program has been typed
in, RUN 9000 will SAVE the program to tape and will then RUN the main program.


--
Another Fine Product transcribed by:
Jim Grimwood (jg27paw4@globalnet.co.uk), Weardale, England
--
