Popular Computing Weekly 09/12/1982 Pages 8 & 9

Lunar Lander

A new game for 16K Spectrum and 1K ZX81 by Gordon Cooper

This program runs on a 16K Spectrum. It uses the colour and high resolution
plotting facility of the Spectrum to show the spaceship landing on a rugged
lunar surface. To land safely will require all your skill. You must angle and
fire your rocket to counteract gravity, the downwards fall and sideways drift.
For experienced pilots there is an option to have a solar wind, making landing
even more harder.

To help you land, there is a constantly updated plot of your angle and position
on the screen. You also have digital instruments showing your height, speed,
drift and remaining fuel. You control the craft by rolling left or right, and
deciding the amount of rocket thrust.

To start the game, load the program and issue the RUN command. There is an
option to display instructions on the screen. Once past these you will find a
solar wind blowing. To begin with, use your plasma bomb to stop this. As you
become more experienced, you can omit the bomb and have a side wind to
counteract as well.

At this point, the radar scanner will start, with sound and colour effects.
Once working, it will display the craft at the top left of the screen, above a
rugged surface. Enter L or R to roll left or right, and H to hold your angle
once you are happy with it. Now enter the number of gallons of fuel you wish to
burn this cycle. Start with a number between five and 10. Carry on in this way
until you have landed.

Happy landings. If you are not perfect your craft will topple over, or
disintegrate while a funeral march plays. A perfect landing needs a speed less
than 4, and a drift less than 2. You will find it slightly easier to land on
level high ground.

To speed the execution of commonly used routines, three subroutines are placed
at the beginning of the listing. To pass over these, line 2 passes control
straight to line 80. Between lines 80 and 110 is the code to determine whether
you want a wind to harass your landing. Lines 122 to 130 start up the radar,
with colour and sound effects. Control then passes to the subroutine at line 13
to plot the moon surface.

The plotting subroutine plots vertical lines of alternate pixels from the
bottom of the screen to the randomly varying moon surface held as v(x). This is
done by both lines 20 and 26. The two lines start plotting one pixel apart, at
z -- 0 or 1. This prevents the appearance of horizontal lines over the moon's
surface.

Once the surface is plotted, which takes quite a time, control passes to line
200, where the variables are set up with initial values. Line 235 adjusts the
amount of fuel to compensate for the wind and drift. These values are then
printed by the subroutine at line 4. This is at the beginning of the program to
speed its execution. It is called 10 times in each fuel burn cycle.

The main loop, which handles each descent and fuel burning cycle, begins at
line 250. It begins by adjusting the pitch of the craft in response to the left
or right commands. While doing this it updates the screen picture by calling
the subroutine twice, once with OVER 1 to rubout, then with OVER 0 to plot the
new angles. Line 410 determines how much fuel is to be burnt, with the lines up
to 620 adjusting the variables accordingly. These simulate the effects of
rocket thrust, gravity and wind.

Lines 650 to 870 handle the landing. Depending on speed, you get three victory
roll sounds, the craft topples over, or disintegrates. If it breaks up, a
funeral march starts at line 5000, and a cross is placed at the grave by lines
1050 to 1084.

ZX81 Lander

This program is designed to run on a standard 1K ZX81 in SLOW mode. It produces
a moving graphic image of a lunar module descending to the moon surface. The
altitude, speed and remaining fuel are also displayed on the capsule's digital
instruments.

To start off try entering 5, which will leave the speed the same while using 5
of your precious gallons of fuel. If you burn more than 9 in a given period you
will see the jet/rocket exhaust.

NOTE - Both versions for the ZX Spectrum and ZX81 of the Lunar Lander game are
included in this folder. I have also converted the original ZX81 version over
to the ZX Spectrum, so you can also play this version of this game on that
computer. I have also included the original .P file of the game which runs on
the ZX81 only.