MAD MINER
by J.D. Rogers
from ZX Computing Aug/Sep.1984

You've got to be mad to work in a plutonium mine
say J Dave Rogers and Colin Hogg of Liverpool.


Your job is to collect plutonium (which appears as numbers
scattered around the mine) while blasting your way through
obstacles and avoiding the acid rain dripping from the
stalactites, which are also, of course, inching their way
down from the roof of the mine. Any stalactite, when it
grows too long, can snap without warning and turn into a
falling block. The drips and blocks crash through walkways
(black floor) but there are auto- repair systems that will
maintain enough for you to walk on (grey floor).


Hazard warning

As long as you have energy you are unaffected by the
radiation in the mine, but if you ever let your energy drop
to zero then you are destroyed. As if all this wasn't
enough, you must also keep a careful eye on the black and
white bar-graph across the top of the screen because this
represents the running total of uncollected points. These
are points that have appeared but were not collected and
were destroyed by drips or blocks. If this builds up to
'Critical Mass' (all black) then you and the mine are
annihilated in a nuclear explosion. This is your incentive
to gather up the points reasonably quickly and not miss any!
The final hazard is that the doors between the 'lift shaft'
and the mine will occasionally slam shut.


How to play

Go under numbers to collect points and under plus signs to
collect energy. Each plus gives you another 50 energy units
but don't try to go over 200, as 'over charging' will only
reduce your energy by twenty units. If you run into or under
anything except numbers or plus signs you 'crash', lose
fifty energy units and are relocated to the lift shaft.

Control keys for the left hand are 'X' and 'C', which move
the man left/right, (key 'Z' can also be used instead of 'X'
if you find it more comfortable). Key 'F' fires the laser
three spaces in the direction the man is facing at the time,
using up twenty energy points in doing so.

Control keys for the right hand are 'M' and 'N', which
operate the lifts up and down when the man is on a lift
position. These keys are also 'mend' floors when the man is
not on a lift position. There are two lift positions (marked
by the 'L's) in the mine itself and a five-way lift complex
in the lift shaft. Lifts stop at walkway levels
automatically, not in between, and you can get onto a lift
in mid-air (antigravity lifts!).

If you bear in mind that drips and blocks fall through
damaged (grey) floors until they hit an intact (black)
floor, 'mending' a damaged floor (key M) means that any
points underneath it can be protected until you have a
chance to collect them. Also, try to leave lifts in the most
usable positions. Even so, it is sometimes necessary to
clear away 'remains' of previously used lifts by firing the
laser into them. If anything is not clear the quickest way
to learn is just to play the game a few times.


The program in operation

Line numbering may seem a little eccentric in places but
must not be altered as it is due to the use of 'GOTO CODE
INKEY$' which routes the program to different line numbers
depending on which key is pressed. This gives faster
operation than using lots of separate "IF INKEY$ EQUALS"
statements for each function, but it also means that
pressing keys other than those specified in the playing
instructions may give unpredictable results. This is no real
problem though as all bottom row keys are OK, and obtaining
reasonable speed is the more important consideration with
ZX81 BASIC! Despite there being lots of different things
happening in the game, man- movement remains at a good pace
due to careful overall program structuring.


Along the lines

Here follows a brief description of the program functions,
line by line.

5-10      Subroutine called from various points in the main
          program. Sends program to other subroutines depending
          on keys that are pressed and what is above the man's head.
50-52     Man move right. Prints man facing right and a space
          to the left of man to rub out previous position.
53-59     Fire laser three spaces in direction man is facing at
          the time.
62-69     Lifts up and down stopping only at walkway levels,
          not in between.
73-75     Man move left. Prints man facing left and a space to
          the right.
200-270   Main loop. 'Grows' stalactites at random and calls all
          the other routines via line 270.
270       'Goes to' random lines between 2.0 and 320, thus
          choosing any one of five randomly occurring events:
          (drip/print points/mystery bonus points/doors shutting
          /autorepairs). The line numbers are very important here
          because they determine the relative probabilities of
          these events happening. Basically, the higher the line
          number the more chance of it happening. For example,
          line 275 'shuts the doors' into the mine and has a
          5 in 50 chance of being chosen each time the main loop
          is executed.
320-360   First part of 'drip' from bottom of stalactite.
400-440   Drips/blocks fall through damaged (grey) floors until
          reaching an unbroken (black) floor. The same FOR NEXT
          loop is used for dropping either drips or blocks,
          being set up with different values for each function.
450-480   Decreases level of unbroken floor represented in
          array H after it has been hit by a drip or block, then
          reprints floor in grey after it has passed through.
500-590   Print random value points, at random positions, at
          random times during game. Keeps record of total
          uncollected points, prints bar graph (line 560) and ends
          game if bar graph reaches maximum.
600-650   Manual floor repair.
670-672   'Mystery bonus points', 0 to 9.
800-950   Routines for picking up points or energy, then updating
          and printing the score or energy level on screen.
1000-1060 'Crash' routine, then relocate man to lift shaft.
2000-2080 Auto repairs. Scans along floors repairing every two
          or three. This is done so that the game can never
          deteriorate into 'all blocks on the bottom floor'.
3000-     Initialise variables and print screen. Some graphics are
          held in strings to simplify printing by repeating them.


Typing tips

Line 51   Space, graphic 'greater than'.
Line 74   Graphic 'less than', space.
          It is essential to use the above characters, since line 53
          looks at these to decide in which direction to fire laser.
Line 250  Graphic shift G.
Line 640  Graphic shift seven.
Line 880  Twenty spaces between the quotes.
Line 2040 Graphic shift seven.
Line 4060 32 greys.
Line 5010 Graphic colons.
Line 5030 24 x graphic shift 7, graphic space.
Line 5040 All graphic: "L, 8 colons, L, 14 colons, LIFTS, 3 colons".
          Also check lines 235, 505, 1010.

Before you run the program, erase line 7080 and save a few
copies on tape! Note that full on- screen instructions have
been omitted to keep program length down but can easily be
added. A demonstration - only version just to display the
mine / drips / blocks, etc. can be obtained if line 286 is
temporarily erased, line 272 edited to 'GOTO 2000' and line
5 replaced with 'RETURN'. This will then run indefinitely.


Variables

S          Screen position of space above man's head.
X          Marks the start of display file.
L          Level (or line) the man has reached.
M          Man position (left/right).
Y          Character above man IF it is not a space.
A          'Across' coordinate for all actions involving stalactite
           growth, drips or block drops.
FI         Fire direction for laser, depends on character of man.
DI         Lift direction.
H(N)       Height of undamaged floor at position (N) across.
G(N)       Growth of stalactite at position (N) across.
Y          Used to hold value of G(N) to allow faster program access.
ORI,GAP,CH These set up FOR NEXT loop with origin, gap and
           character for dropping either drips or blocks.
R$         Random points to be printed.
TM         Total missed; ie. points printed but not collected.
BP         Bonus points.
SC         Score.
EN         Energy.
P$         Printing string. Used to simplify initial setting up by
           repeating. Also used to reprint bottom line after auto
           repairs have occurred.


Optional extras!

Having typed in and used the main program, the machine code
routine can be added. This causes a 'patrol-man' to appear
at annoyingly unpredictable intervals and chase you along
the levels. Since he's only slowed a bit by your laser, the
only escape is to get to a lift in time!

To add this feature, first type in (as line one) a REM
statement containing any 170 characters, then type in and
run the hex- loader program (Program 2) and enter the data
line by line. You will now have to add the lines in Program
3 to your listing.


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