100% found this document useful (1 vote)
406 views52 pages

Computer Battle Games

Create and play these exciting battle strategy games on your ZX Spectrum,Z81 BBC, TRS-80, Apple, VIC & PET

Uploaded by

tyrant88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
406 views52 pages

Computer Battle Games

Create and play these exciting battle strategy games on your ZX Spectrum,Z81 BBC, TRS-80, Apple, VIC & PET

Uploaded by

tyrant88
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

COMPUTER

/ i

^SpeCtrU-^8,BBC,TRS-80.App^

. . . . . o .
0

m
M
*

. o . .

PROGRAMS

&

COMPUTER

*W"

TTLEGAME
Daniel lsaaman
and Jenny Tyler
Contents

2
4
6
8
10
12
14
16
18
20
22
24
26

AboutthisBook
RobotMissile
TheVitalMessage
Shootout
DesertTankBattle
Battle at Traitor's Castle
Robot Invaders
SecretWeapon
Escape!
PirateDogfight
SupersonicBomber
Iceberg
TheWall

30
31
32
33
34
35
36
38
40
46
47

Missile!:TRS-80version
Missile!:BBCversion
Missile!:ZXSpectrumversion
Missile!:VIC20version
Missile!:Appleversion
Missile!:ZX81 version
Addingtotheprograms
Writing your own programs
SummaryofBASIC
Conversionchart
PuzzleAnswers

Illustrated by:
Rex Archer, Jim Bamber, Tony Baskeyfield, Martin Newton
and Graham Round

Designed by:
Graham Round and Roger Priddy
Robot Invaders program by Bob Merry
First published in 1982 by Usborne Publishing Ltd,
20 Garrick Street, London WC2E 9BJ
1982 Usborne Publishing Ltd

AboutThisBook
This book contains simple games
programs to play on a microcomputer.
They are written for use on ZX81, ZX
Spectrum,BBC,VIC20,
TRS-80 and Pet and Apple micros, and
manyare short enough to fit into the
ZX81'slKofmemory.
Points to remember
Most micros use the language BASIC,
1 Type the Unes exactly as they are printed
but they aU have their own variations or
including
aU punctuation and spaces.
dialects. In this book, the main listing for
2
Press
RETURN,
NEWLINE or ENTER
each program works on the ZX81 and
key
at
the
end
of
each
program Une.
Unes which need changing for the other
computers are marked with symbols and 3 CheckeachUneasyougo.
printed underneath. The fact that the
4 Makesureyoudon'tmissoutaUneor
programs are written for several micros
confuse one with another. A piece ofpaper
means that they do not make fuU use of
or a ruler is useful to mark your place in
each one's faciUties. You could try
the Usting.
finding ways of making the programs
5 Lookoutforthesymbolsandmakesure
shorter and neater for your micro.
you use the correct Unes for your
For each game, there are ideas for
computer.
changing and adding to the programs
6 If you are using a ZX81 or ZX Spectrum,
and towards the back ofthe book you
remember not to type the program
wiU find tips and hints on writing games
instructions letter by letter but to use the
of your own. Also in the book is a
special key for each instruction instead.
conversion chart to help you adapt
programs in magazines and other books
You may find it easier to get someone to
for your micro and a summary ofthe
read the program out to you while you
BASIC terms used in this book.
type it in. Don't forget to explain thatthey
must read every comma, fuUstop, bracket
and
space and differentiate between letter
Typing in the programs
"0" and zero, FOR and 4, and TO and 2.
Lines which need changing for
computers other than ZX81 are marked
Debugging programs
with these symbols:
When you have typed
A VICandPet
in the program, check
* BBCandAcornElectron
your
manual to find out
TRS-80
how
to
display it on the
Apple
s
screen.
(Usually you
ZXSpectrum
type
LIST
foUowed by
Every time you see the symbol for the
the
line
numbers
ofthe
micro you are using, look below for the
section
you
want
t
o
corresponding Une number with the
see.)
same symbol and type that in instead.
VIC20 versions ofallexcept thegraphicsprogram should workon
Petcomputers.

Checkyouhave
typed everything
correctly. It is easyto
make mistakes, so
expect to find some. Use
your manual tofindout
how to make changes to
the program once it is
typed in. Ifin doubt, you
can always type the line
again. AU the computers
wiU replace an existing
hne with a new one with
the same number.
Here is a checklist of common
mistakes to look out for:
1 Linemissedout
2 Linewronglynumbered
3 Thebeginnihgofonehnejoinedonto
the end ofanother.

4 Brackets, commas, colons, semicolons, fullstops or spaces missed out,


especiaUy in long, compUcated lines.
Watch for double brackets in particular.
5 Wrong Une used for your computer.
6 Letter "O" confused with zero.
7 Wrong numbers used, e.g. extra zeros
included.
Playing the games
To start the game you must type RUN. In
some games things happen very quickly,
so make sure you have read the
instructions and know what you are
supposedtodo.
It is quite Hkely that the program stiU

has a mistake in it and either won't i


at aU or the game won't work properly.
Sometimes your computer wiU give you
an error code which you can look up in
the manual. This may help you findthe
mistake, though not always. List the
program again and check it carefuUy
againstthebook.
Whenthe game is over, the computer
wiU usually say something like BREAK IN
LINE 200. To play again, you have totype
RUN.
Experimenting with the games
There are suggestions for changing and
adding to the programs throughout the
book, but don't be afraid to experiment
with changes ofyour own. You can't
damage the computer and you can
always change back to the original ifthe
changes don't work.
You wiU probablyfindyou want to
adjust the speed of some games, *
especiaUy after you have played them a
number of times. You willfindout which
Une to change on each program page.
Wherever you see
PRINT,youcan
change the message in/
quotes that foU6ws it toJ
whatever you Uke.
Also, unless you have
ZX81 with only lK, you
can add extra
messages.
Type a line number (say 105 ifyou want
to add a message between lines 100 and
110), then type PRINT, then your
message inside quotes.
Ifyour computer can make colours
and sounds, you could use your manual
tofindout how they work and try adding
them to the games in this book.

*Seepage37foraspecialnoteforBBCandSpectrumusers.

RobotMissile
The year is 2582 and the people ofEarth are inthe
midst ofbattle against the Robots. A lethal Robot
Missile has just landed and everyone is depending
on you to find the secret code which unlocks its
defuse mechanism. Ifyou fail, the entire Earth
Command Headquarters will be blown up.
Your computer knows what the code
letter is. You must type in your guess and
it wUl tell you whether the code letter
is earUer or later in the alphabet.
You have four chances to find the
correctletterbeforethemissile
blowsup.
iiUf*.
m. -'** .,11, matfmJlw
TrWr"
, j M*Sl
^ B i ^

t i\ ii
%

III

mB
**

How the program


works
10
20
30
40
50
60
70

PRINT
PRINT
PRINT
PRINT
PRINT
PRINT
PRINT

s*BA#80 LET

*
"ROBOT MISSILE"

- These Unes print the title and


instructions.

"TYPE THE CORRECT CODE"


"LETTER (A-Z) TO"
"DEFUSE THE MISSILE."
"YOU HAVE 4 CHANCES"

C*=CHR*<37+INT<RND*26+1>>-

K>

i1

CS \ L i n e 9 0 begins a loop which


_ J makes Unes 100-140 repeat 4
times.
Puts your guess in GS.

90 FOR G=1 TO 4
100 INPUT G*

110 IF G*=C* THEN BOTO 210'

This selects a number


between 0 and 26, converts it
to a letter (the "secret code")
and puts it in CS.

120 IF G*<C* THEN PRINT


130 IF G*>C* THEN PRINT
140 PRINT " THAN ";G*

"LATER";
"EARLIER";

Checksifyourletteristhe
same as the "secret code" in
CS. Ifso computerjumps to 210.

Checksifsecret code letter is


I earUerorlaterinthe
J alphabetthanyoursand
prints an appropriate
message.
End ofloop. Goes back for
nextturn.

150 NEXT G

160 PRINT
"
170 PRINT "BOOOOOOOOMMM
- This prints if aU your guesses
180 PRINT "YOU BLEW IT."
were wrong.
190 PRINT "THE CORRECT CODE WAS";C*
200 STOP
210 PRINT " T I C K . . , F Z Z Z Z . . CLICK.
- This prints ifyou guessed
220 PRINT "YOU D I D I T "
right.
?30 STOP
The a b o v e tisting will woxk on a ZX81. For
other computers, m a k e the c h a n g e s b e l o w .
* A 8 0 LET C * = C H R * < 6 4 + I N T < R N D < 1 > * 2 6 + 1 > )
8 0 LET C * = C H R * ( 6 4 + I N T ( R N D ( 0 ) * 2 6 + 1 ) )
s 8 0 LET C t = C H R * ( 6 4 + I N T ( R N D * 2 6 + l ) )

T^
Puzzlecorner

Adding to the program

i
/

\ \

You c a n m a k e the computer print an


extra m e s s a g e for a correct g u e s s on the
last go. C h a n g e tine 220 b y adding a
s e m i c o l o n to it, tike this:
220PRINT"YOUDIDIT";
and add a n e w tine 230:
230 IF G=5 THEN PRINT "OUST)"
B0._ i u i . j i m , i . , ,

ii.

. p..^..iw

See i f y o u c a n work out h o w to c h a n g e


the program to g i v e y o u more or l e s s
c h a n c e s of g u e s s i n g the c o d e le,tter.

The Vital Message

i
.^

_
a
>

^j^TSk
4

-ai,

f/ rA *s^
'

v , ' ^4yr

**&4*

*'** *$sSf
**%

**^v

w to * if M

Ni2

Youarealaser
communications
operator. Your
job is to intercept
robot messages and relay
them to Command HQ. A vital
code message is expected. Ifyou
relay it correctly, the Robot attack
wiUbecrushed.
This game tests your skUl at
remembering a group of

letters which you


see for only a very
short time. The computer
wiU ask you for a difficulty
from 4 to 10. When you have typed
in your answer, letters will appear
top left of your screen and disappear
again fairly quickly. Memorize them
and then type them into the computer
and see if you were right.

How the program works


Clean screen before game starts.
CLS.
PRINT "VITAL MESSASE"
PRINT
fisksyoufora"difficuItynumber"and
PRINT "HOW DIFFICULT? ( 4 - 1 0 ) "L_putsitinD.
INPUT D
J
IF D<4 OR D>10 THEN GOTO 40
Checksyournumberisn'tlessthan4
ormorethanlO.
Sets up an empty ("nuU" in computer
language) string labeUed MSinwhich
7 0 LET M*==""
the computer can store the secret
message.

10

20
30
40
50
60

80 FOR 1 = 1 TO D
~ | ComputerloopsroundDtimes.Each
8*A90 LET M*=M*+CHR*<INT<RND*26+38) )Lloopitchoosesaletterandaddsitto
100 NEXT I
| thestringoflettersithasabeady
chosen and put in MS
A#110 CLS
120 PRINT "SEND THIS MESSAGE:
130 PRINT
I
Clearsscreenandthenprintsthe
140 PRINT M*
J
message.

. 1160
5 0 NEXT
FOR 1I= 1 TO D * 8 l

tttttZEEgZ***

for a number of times depending on D.


iii.ii- Clears screen when loop has finished.
Puts your version of the message in
NS.
< Checks ifyour message is the same as
IF N*=M* THEN GOTO 240the message in MS andjumps to 240
ifitis.
PRINT "YOU GOT IT WRONG"
PRINT "YOU SHOULD HAVE SENT: Prints if you are wrong, teUing you
PRINT Mt
what the message should have been.
GOTO 260
PRINT "MESSAGE CORRECT"
PRINT "THE WAR IS OVER"
STOP

A#170 CLS
180 INPUT N*190
200
210
220
230
240
250
260

The above Usting wiU woxk on a ZX81. For


other computers, make the changes below.
#10,110,170 HOME
A10,110,170 PRINT CHR*(147)
*A#90 LET M*=M*+CHR*(INT < RND <1)26+65)
90 LET M*=M*+CHR*(INT<RND(0)*26+65)
s90 LET M*=M*+CHR*(INT<RND*26+65))
A150 FOR 1 = 1 TO D*180
150 FOR 1=1 TO D*400

Howtomakethegame harder
You can change the program to include
numbers and punctuation marks in the secret
message. Do this by changing line 90 as foUows:
zx90 LETM$=M$+CHR$(INT(RND*43+21))
A 9 0 LETM$=M$+CHR$(INT(RND(l)*43+48))
90 LETM$=M$+CHR$(INT(RND(0)*43+48))
s90 LETM$=M$+CHR$(INT(RND*43+48))

Shootout
V

1 0 CLS
You are standing back to
20 PRINT "COWBOY SHOOTOUT -"
back. You take 10 paces, turn
30 PRINT "YOU ARE BACK TO BACK"
and reach for your gun. How
40 PRINT "TAKE 10 PACES..."
quick are you? Can you
50 FOR 1 = 1 TO 1 0
shootfirst?
PRINT I ;
Your computer prints the ^ t p o NEXT I
^" 70
numbers 1 to 10to represent
80 PRINT
the 10 paces, pauses and
90 FOR 1=1 TO RND*200
en prints HE DRAWS...
100 NEXT I
must be ready to press a
y(anyonewill(
llO IF INKEY*<>"" THEN GOTO 160
i^mgfcesewords
thescreen.Ii
120 PRINT "HE DRAWS
";
enough, you #fltwifl$8bn't,
ssakeybefareH"
130 FOR 1 = 1 TO 5
WScomesupoi
1 4 0 IF INKEY*<>"" THEN SOTO 190
.ticaUylose.

1 5 0 NEXT I

To
keyao*

160
170
180
190
200
210

PRINT "AND
PRINT "YOU
SOTO 210
PRINT "BUT
PRINT "YOU
STOP

"
1
AD.'J

SHOOTS
ARE DEAD

YOU SHOOT FIRST.


KILLED HIM."

The above Usting wiU work on a ZX81. For


other computers, make the changes below.

How to change the


speed ofthe game

L^L

You can adjust the time you


have to react to the message
and press a key by changing
the last number in Une 130. A
smaUer number wiU give you
less time. (For the BBC,
change the number in
brackets in Une 140.)

10 HOME
10 PRINT CHR*(147)
60 PRINT |I|".."|
65 FOR J=1 TO 300 : NEXT J
90 FOR 1=1 TO RND(l>*lOOO
90 FOR 1=1 TO RND(0)*1000
110 IF PEEK(-16384)>127 THEN GOTO 160
110 GET I* : IF I*<>"" THEN 60T0 160
110 IF INKEY*(1)<>"" THEN GOTO 160
130 FOR 1=1 TO 20
130 FOR 1=1 TO 50
DELETE 130,150
140 IF PEEK(-16384)>127 THEN GOTO 190
140 GET I* : IF I*<>"" THEN GOTO 190
140 IF INKEY*(40><>" THEN GOTO 190

^ai
jmq

Making the game harder


Ifyou change the program as foUows, you wiU add
the possibUity ofyou missing sometimes:
1) bi Une 140, change 190 to 220.
2)AddtheseUnes:

M i

s ZX 220 ff RND>.3 THEN GOTO 190


220ffRND(l)>.3THENGOTO 190
220 ff RND(0)>.3 THEN GOTO 190
230 PMNT "BUT YOU MKSED"
240GOTO90

^^_^

Howthe program works

This is a loop which sends the


computer round 10 times to
print a number and two dots
1
eachtime.
Another loop - this time to
make the computer delay.
The computer loops round a
. number oftimes depending
on the value ofRND, doing
nothing.
Checks you're not cheating
by pressing a key before HE
DRAWS comes on the screen.
Prints the signal for you to
pressakey.
Checks the keyboard to see if
. you are pressing a key, and
jumps to 190 ifyou are.
(Notice that Une 140 is in the
middle ofa FOR... NEXT
loop. This makes the
computer check the
keyboard a number oftimes
to give you a reasonable
chance ofpressing a key.)
, Prints ifyou lose. (Either you
ran out oftime or were
cheating.)
Prints ifyou win.

, An extra delay loop for the


faster computers.
Notice how the different
computers check the
keyboard: Vic uses GET,
Apple has to PEEK into its
memory, the others use
.INKEY$.

"3
i*J"l^

Puzzle corner

'1

See ifyou can work out*


how to make it possible
for the computer to miss
too.

DesertTankBattle
The last major stronghold ofRobot forces outside the U.R.S* is hiddeninancient
castle ruins in the middle ofthe desert. A fleet ofdesert hovertanks has beensent
to destroy it and you are the commander. Your tank controls the five remaining
missiles.
You must assess carefully the direction and elevation before you launch each
one. Your computer wiU ask you for a direction angle between 90 (extreme left)
and +90 (extremeright)and an elevation angle between 0 (along the ground) and
90 (straight up in the air). The elevation determines the distance the missile wiU
travel.
Is your aim good enough to destroy the robot stronghold?

Howthe program works


This selects a whole number
. between -90 and 90 forthe
direction.
This selects a number
between 0 and 1 for the
distance ofthe castle from
you.
Get your guesses and puts
them in A and B.

10 PRINT "DESERT TANK BATTLE'


A 2 0 LET T=INT(RND181 )-90
A 3 0 LET D=RND40
50
60
70
80

FOR S=1 TO 5
PRINT "DIRECTION <-90 TO 90) ?"
INPUT T1
>) ?"
PRINT "ELEVATION (0 TO
INPUT B

Uses your elevation angle to


calculate the distance your
missile went. (Answer wiU be
between 0 and 1).

90 LET Dl=SIN(2*(B/1803.1416>).

lOO I F A B S < T - T l ) < 2 AND A B S < D - D l > < . 0 5

THEN 60TO 2 2 0

ABS takes the "absolute" \


value of a number, which J
means it ignores + or J
signs.

Ifyour

directionwaswithin2 degrees
and your distance within 0.05,
then you have hit the castle,
Program jumps to line 2 20 to
teU you so.

1 1 0 P R I N T " M I S S I L E LANDED " ;


~ | Comparesyourdirection
1 2 0 I F T l < T THEN P R I N T "TO THE LEFT " ; U a n g l e w i t h t h e n u m b e r
1 3 0 I F T l > T THEN P R I N T "TO THE RIGHT " ; | choseninline20andprints

an appropriate message.
140

IF ABS(Dl-D)>.05

AND T l < > T

THEN P R I N T

"AND " j

Decides

whethertoprint "and" by
A semi-colon at the end ofa print statement X comparing the distance
tells the computer notto go to a new Une for ) your missile travelled with
thenextitemtobeprinted.
S thenumberchoseninUne30.
150
160
170
180
190
200
210
220
230
240

Prints a message
IF D-Dl>.05 THEN PRINT "NOT FAR ENOUGH";
ifyourshot was
IF Dl-D>.05 THEN PRINT "TOO FAR
too long or short.
PRINT
NEXT G
PRINT DISASTER - YOU FAILED
Prints ifyou lose.
PRINT 'RETREAT IN DISGRACE"
STOP
1
PRINT "*KABOOOMMM*,
Prints ifyou win.
PRINT "YOU'VE DONE: iT"J
STOP

The abovetistingwill work on a ZX81. For


other computers, make the changes below
*A#20
20
*A30
30

LET
LET
LET
LET

T=INT(RND(l)*181)-90
T=INT(RND(0)tl81)-90
D=RND(1)
D=RND(0)

Puzzlecorner
Can you work out how to add the
possibility ofthe robots seeing you and
shooting at you before your five goes
areup?
11

UnitedRobotStates

BattleatTraitor's
Castle

*
&

lO PRINT "TRAITOR'S CASTLE'


20 LET S=0 ~ ~
30 FOR G=1 TO lO 1
40 LET R$=""
| * B A * 5 0 LET T=INT(RND*9+1)60
70
80
90

FOR L=1 TO 9
IF L=T THEN LET R*=R*+"0"
IF L O T THEN LET R*=R+".'
NEXT L

lOO PRINT

R*,'

4 1 1 0 FOR 1=1 TO

*xri220
The King is waging a fierce and
bloody battle against his
deadliest enemy - the Traitor
Baron. You are one ofthe King's
crack bowmen and at this very
moment you are crouching
behind the bushes outside the
Baron's Castle, shooting at his
men as they lift their heads above I
the battlements.
Your computer will print a row
containing eight dots and an O.
The number keys 1 to 9
correspond to the position of the 0
in the row. You have a short time
to press the correct key, and hit
the O, before it disappears.
How many ofthe Baron's men
canyouhit?

LET I*=INKEY*

130 IF VAL<' O"+I*)=T THEN GOTO 170140 NEXT I


150
160
170
180
190

PRINT "MISSED'
GOTO 190
PRINT "GOOD SHOT"
LET S=S+1
NEXT G

200 PRINT "YOU HIT '*jS;"OUT OF 10'


210 STOP

The above Listing wiU work on a ZX81. For


other computers, make the changes below.
5 0 LET T = I N T ( R N D ( 0 ) * 9 + 1 )
* A * 5 0 LET T=INT<RND<1>*9+1)
A 1 1 0 FOR 1 = 1 TO 200
110 FOR 1 = 1 TO 60
1 1 0 FOR 1 = 1 TO 90
1 1 5 LET I * = " "
i * 1 2 0 LET I*=INKEY*<1)
1 2 0 I F PEEK(-16384)>127 THEN GET I *
M 2 0 GET I *
1

'

'

Making the game faster or slower

E5'

You may find that the computer works too quickly


or too slowly for you in this game. You can adjust
this by changing the last number in line 110. A
lower number wiU make the game faster.

Puzzlecorner
Can you change the program so that you get two
i kinds of target - either O (one of the Baron's
Ordinary soldiers) which is worth 1 point, or S
(one of his Special branch) which is worth 5
points?

Howthe program works


Sets your score to zero for
startofgame.
Beginning ofloop which
gives you 10 goes.
Sets up an empty string, RS.
1
Selects a number between 1
and 9 and puts it in T.
Loops round 9 times, adding a
character to the string, RS,
each time. The character is O
fortheposition
corresponding to the number
in T and a dot for all the others.
Prints the string.
Loops round a number of
> times to see if you are
pressing a key. (End ofloop at
Une 140)
' Checks ifyou are pressing
the right key. Jumps to 170 if so.
Prints ifyou pressed the
- wrong key or didn't press in
time, thenjumps to 190.
Licreases your score by 1.
- Sends computer back to line
30foranothergo.
Prints your score when 10
goes are up.

&&

$*Hr
j C . -*^A

_ j ; :-w
Notice how the scoring works
in this program (Unes 20 and
180). You could try adding
this to other programs.

f*K /' ^ ^

w>

'l*&wmito&

530?
g*^<TTI^l!^"/

~V

'

bB-I: /*

iM&
v<*m
7\mk(,
^ 1 ^ ^ 1

X<;4/

S 9^^9*r.

M^^mH

Robot Invaders
You must act quickly.
Robot invaders of all kinds
are approaching. You
have plenty ofweapons,
but for each type ofRobot
you must select exactly
the right one for it to have
anyeffect.
Code symbols for each
Robot will flash up on your
screen. Quickly press the
key with that symbol on it
- beware, some need the
shift key too - and see how
many Robot invaders you
candestroy.

m*f

u
^

IP

ff

CZ3

' IMI
kji

T 1~

^^m^

^"

How the program works


10 PRINT "ROBOT INVADERS"
20 LET H=0
30 FOR T=1 TO 25
I A * 4 0 FOR 1=1 TO INT(RND*30+20)
50 NEXT I
A60
A70
|s*BA#80
A90

- Sets score to zero for start.


Beginning ofloop which
givesyou25goes.

LET A=INT<RND*20)
LET D=INT<RND*15>
LET P*=CHR*(INT(RND*53+11)).
CLS

100
110
120
130
A140
^A#150
160
170
180
190
200
210
220
230
A*240
250
260

:}

FOR J=0 TO D
PRINT
NEXT J
PRINT TAB<A);P*
FOR 1=1 TO 15
LET R*=INKEY*
IF R*=P* THEN GOTO i 10
IF R<>"" THEN GOTO 190
NEXT I
PRINT "MISSED"
GOTO 230
PRINT "A HIT"
LET H=H+1

NEXT T
CLS
PRINT "YOU SCORED ";H;"/25"STOP

- Random delay.
Selects numbers for across
and down positions on
- screen.
Choosesakeyboard character.
-Clearsscreen
Moves cursor down the
screen, one Une at a time,
-until it reaches Une number O
(which was chosen in Une 70).
- Moves cursor A spaces
across the screen and prints
the character chosen in Une
80there.
-Checks keyboard a number
oftimes to see ifyou are
pressing a key, checks ifthis
is therightkey and then
jumps to the appropriate Une
to print hit or miss.
- bicreases score by 1.
- Goes back for another turn.
Prints score after 25 goes.

CZD

<r- -

-X

LL

ie above usting wiU work on a ZX81. For


other computers, make the changes below.

Speeding upthe game

4 0 FOR 1=1 TO INT<RND<T>*300+200)


4 0 FOR 1=1 TO INT(RND<0)*300+200)
6 0 , 7 0 change RND t o RND<1>

As you get used to playing this


game, you wiU probably find
you want to speed it up. Do this
by changing the last number in
tine 140 to a lower one.

60,70 change RND to RND(0)


*A80 LET P*=CHR*<INT<RND<l>*58+33>>
SO LET P*=CHR*<INT<RND<0)*58+33))
s BO LET P*=CHR* (I NT (RND * 58+33) )
90,240 HOME

Movingthecursor

A 9 0 , 2 4 0 PRINT CHR*(147)
A 1 4 0 FOR 1=1 TO 150

145
150
A150
150

R*=""
R*=INKEY*<1)
GET R*
IF PEEK(-16384)>127 THEN BET R*

Your computer may have a


simpler way ofmoving the
cursor to a particular point on
the screen (see tines 100-130).
Check your manual and see.
"

Puzzlecorner

JL W X-

These are
the most
dangerous of
the robots.

Mechans

>XT

* T

Tintroids

Scrapions

Wireheads

Steeleyes

Can you adjust the program so that you get 100 points for each ofthese and
only 10 points for any ofthe others?

Y>*

SecretWeapon
Ifyou could destroy the main Robot Spare Parts Store, which lies
underground somewhere in the eastern wastes ofthe U.R.S., you could
cripple the robot attack quite severely.
You have a new secret weapon, as yet unknown to the robots, which
can cut silently through soUd rock, vapourizing everything in its path.
The Store is very cleverly concealed though. All you can do is aim
your weapon bUndly and hope you get somewhere near the target.
Your computer will ask you for a difficulty number (the
smaUest number aUowed is 4) and then ask for your
guesses for the X and Y coordinates ofthe target. (Enter
these separately, pressing RETURN, NEWLINE or
ENTER after each one.)
Foracluetothepossible
^^y*><t&S
valuesofXandY,look
^*>
carefully at the program
_^,^Zy^SM
tisting.

16

*N

\
.r

N*
A10
20
30
40
50
A60
A70
80

~~_

Howthe program works

CLS
PRINT "SECRET WEAPON"
PRINT "ENTER DIFFICULTY
INPUT D
IF D<4 THEN SOTO 30
LET X=INT<RND*D+
LET Y=INT(RND*D+
FOR 6=1 TO D+5

90 PRINT "GUESSES FOR X AND Y "


100 INPUT XI
110 INPUT Y1
120 LET

130 I F
140 I F
150 I F

Gets a difficulty number from


you, puts it in D and checks it
-isnotlessthan4.
Selects numbers for X and Y.
- Beginning of loop which
gives you a number ofgoes
depending on the difficulty
you chose.
- Gets your guesses ahd puts
theminXlandYl.

Z=SQR((X-Xl)*(X-Xl)+<Y-Yl)*(Y-Yl>)

Worksoutthe
distance between
your shot and the target and puts
theanswerinZ.

i
ChecksZtoseehowclose
Z = 0 THEN GOTO 2 0 0
youwereandprintsa
Z < = 3 THEN P R I N T " C L O S E "
U-message.(IfZ = Oyou've
Z>3 THEN PRINT "NOT EVEN C L O S E ^
won.)

160 NEXT G

End ofloop. Goes back for


nexttum.

170
180
190
200
210
220

PRINT
PRINT
STOP
PRINT
PRINT
STOP

"THE ROBOTS HAVE SEEN


"YOU - A6GHHHHH
"YOU DESTROYED
G;" GOES"

The above Hsting wiH work on a ZX81. For


other computers, make the changes below.

10
A10
*A*60
60
*A#70
70

HOME
PRINT CHR*(147)
LET X=INT(RND(1)*D+1)
LET X=INT(RND(0)*D+1)
LET Y=INT(RND<1)*D+1)
LET Y=INT(RND(0)*D+1)

-Prints when you've used aU


yourgoes.

Escape!
The Robots have caught you, taken your weapons andlocked youup.
Suddenly you remember you stiU have your sonar wristwatch, which can be
tuned to produce sounds ofany frequency. Ifyou can onlyfindthe resonant
frequency ofyour Robot guards, they should vibrate so much they faUapart.
You must be careful not to use frequencies that are too low or the building
wiU vibrate and coUapse on top ofyou. Ifyou go too high, you wUl get sucha
terrible headache you wiU have to give up.
Can you escape the horrors ofthe Robot prison? (Look carefuUy at the
program for a clue to the range offrequencies to try.)
How the program works
1 0 CLS
#
20 PRINT "ESCAPE"
A 3 0 LET F=INT<RND*lO0+l)

Chooses a number between 1


and 100 for frequency of
-m robots and puts it in F.
Puts 1 in L and H. These are
40 LET
used ifyou gotoolow or too
50 LET
high-seeUnes 170-190and
230-250.
60 FOR G=1 TO 5
Beginning ofloop which
aUows you to have 5 turns.
70 PRINT "SUESS'
Gets a guess from you and
80 INPUT F1
pUtsitinFl.
Checks if your guess is
90 IF ABS(F-Fl)<5 THEN BOTO 290within 5 ofF. Ifit is, jumps to
290 to print YOU'VE DONE IT.
Jumps
to 170 if your guess is
100 IF F-Fl>40 THEN BOTO 170'
so low it is less than F by
morethan40.
Jumps to 230 ifyour guess is
110 IF Fl-F>40 THEN BOTO 230'
so high it is more than F by
120 PRINT "NO VISIBLE EFFECT"
morethan40
130 NEXT B
Prints ifyour guess was
140 PRINT "YOU TOOK TOO LONB."
within 40 ofF and goes back
for next turn. If aU turns have
150 PRINT "THE FREQ. WAS ";F
been used, it prints the answer.
160 STOP
Checks the value ofL. The
170 IF L=2 THEN 60T0 210
first time this part ofthe
180 PRINT "TOO LOW...CAREFUL"
program is reached, L is 1. So
190 LET L=2
the computermoves down
200 BOTO 130
the program to print a
210 PRINT "THE BUILDING COLLAPSED"
warning, change L to 2 and go
back for another turn.
220 STOP
Next time Une 170 comes into
230 IF H=2 THEN BOTO 270
operation the program jumps
240 PRINT "TOO HIBH...OUCH"
straightto210toteUyou
250 LET H=2
youVelost.
260 BOTO 130
< These Unes check H in the
270 PRINT "YOUR HEAD ACHES - SIVE UP' same way to give you a
280 STOP
warning first time you go too
highandtellyouyou'velost
290 PRINT "YOU'VE DONE IT"
thesecondtime.
300 STOP
TheaboveUstingwiIlworkonaZX81.For
other computers, make the changes below.

H}

'}

10
AlO
A30
18
"30

HOME
PRINT C H R * ( 1 4 7 )
LET F = I N T < R N D ( 1 ) * 1 0 0 + 1 )
LET F=INT(RND<0>*100+1>

Puzzle corner
The three Robot guards
each have their own
resonant frequency. You
can't escape until you
have found aU three. How
could you change the
\ programtodothis?

Howtomakethe
gameharder
Change the 5 in Une 90 to a
lower number. This means
you have to get closer to F
to win. You can also
increase the possible
range ofF by changing
100 in Une 30 to a higher
number.

PirateDogfight
It's you against the Sky Pirate. He moves ahead, you accelerate-He
drops behind, you slow down. You must try to get level with him andthen
you canfire,hoping that he won't be able tofireand hit youfirst.
Use the letter keys A to accelerate, D to decelerate and F tofire.Your
computer will tell you your speed and position relative to the pirate. You
will need to be ready to press the appropriate keys as soon as youpress
RUN. Keep pressing A and D until you get level and thenfire.

How the program works


10

CLS

20 PRINT "PIRATE DOBFISHT"


30 LET V=INT(RND*ll-5>

40 LET S=-INT<RND*3+1>

20

Chooses a number between


5 and +5 for your speed
relativetopirateandputsit
inV.
Chooses a number for your
distance from the pirate
andputsitinS.Thisis
negative at the start,
which means you
are behind him.

Checks ifthe distance


50 IF ABS(S)>20 THEN GOTO 230between you is more than 20.
60 CLS
Ifso, computerjumps to 230
70 PRINT "YOU ARE ";
to say you've lost sight of
80 IF S<0 THEN PRINT "BEHIND"
him.
90 IF S>0 THEN PRINT "AHEAD"
100 IF S=0 THEN PRINT "LEVEL"
^ ^ ChecksthevaluesofSandV
110 PRINT "YOU ARE BOING ";
and prints your position and
120 IF V>0 THEN PRINT "FASTER"
speed in relation to the pirate.
130 IF V<0 THEN PRINT "SLOWER"
Looks to see ifyou are
140 IF V=0 THEN PRINT "SAME"
pressing a key and, ifso,
^
which one. Ifit is A, your
150 LET I*=INKEY*
speed is increased by 1. IfD,
your speed is decreased by 1.
160 IF I*="A" THEN LET V=V+1
r~~ ifyouarepressingFandS=0
170 IF I*="D" THEN LET V=V-1
(i.e.you'relevel)thenit
180 IF I*="F" AND S=0 THEN SOTO '50 I
I
jumpsto250.(IfSisnot0
when you press F then
nothing happens.)

^
^ifli
j

190 LET S=S+V


A200
210
220
230
240

'}

FOR 1=1 TO 20
NEXT I
GOTO 50

PRINT "YOU LOST SIBHT OF HIM"
GOTO 330

250 IF ABS<V><2 THEN GOTO 290

260
270
280
A* 90

PRINT "YOU ONLY MANAGED TO


PRINT "SCARE HIM."
GOTO 40
IF RND>.7 THEN GOTO 320'

300 PRINT "YOU SHOT HIM DOWN"


310 GOTO ;530
320 PRINT "HE SHOT FIRST"
3 3 0 STOP
The above ttsting will work on a ZX81. For
other computers, make the changes below.
1 0 , 6 0 HOME
A 1 0 , 6 0 PRINT CHR*<147>
* A 3 0 LET V = I N T ( R N D ( l ) * l l - 5 )
30 LET V=INT<RND<0>*ll-5>
* A # 4 0 LET S=-INT<RNDU>*3+1)
40 LET S=-INT<RND<0>*3+1>

Works out the new distance


betweenyou.
Delayloop.
Goes back to 50 to repeat.
Comes into operation ifyou
fired when level. Checks
speed is less than 2 (ignoring
+ and signs) and ifso,
jumpsto290.
Prints a message if speed was
more than 2 when you fired.
Returns to 40 to start again
with a new value for S.
AppUes a random test to see
ifyou fired before the pirate.
Printsamessagedepending
on the result of the test in 290.

145
*150
150
A150
*BA#200
B290
*A*290

i*="I*=INKEY*<1>
IF PEEK(-16384)>127 THEN GET 1
6ET I*
FOR 1 = 1 TO 200
IF RND<0)>.7 THEN 60T0 320
IF RND(l)>.7 THEN GOTO 320

How to make the game easier


You may find this game quite difficult.
To make it slightly easier, add these two
Unes. You wiU then be able to see the
relative positions ofthe two planes
printed on the screen.
195 IF ABS<S)>10 THEN GOTO 200
196 PRINT TAB(w/2);"HIM"
197 PRINT TAB<S+w/2>;"YOU"

Replace w with the width ofyour screen.

Puzzlecorner
The random test in line 290 is loaded in
your favour. How could you change it so
your chances ofwinning are equal?

21

Supersonic
Bomber

You are on a lone supersonic bombing


mission over the U.R.S. Your computer
shows graphs ofRobot population based
on infrared photographs relayed to it by
sateUite. You only have time to attack
one target in five, so you must quickly
select the one with the highest
population ofRobots and release one of
your "Corrodarobe" bombs on it. (These
contain a substance so corrosive it can
dissolve a Robot's body in seconds.)
To release a bomb, press the number
key which corresponds to the number
next to the graph ofhighest Robot
population. Ifthere are two the same,
choose the one with the lowest number.
WiU you be a hero when you return to
base?

Howthe program works


10 CLS
20 PRINT "SL
30 DIM B(5
40 LET S=0

50 FOR G=10 TO 1 STEP -1

60 LET M=1

This sets up B as an "array


variable". It can hold five
different values at a time,
identifying them as B(1), B(2),
B(3),B(4)andB(5).
Sets opening score at zero.
Start ofloop for 10 goes. Done
backwards in this game (i.e.
G=10 for first go, 9 for the
second and so on). This
aUows the delay loop in Une
190 to give you more time for
theearUergoes.
Sets number of highest
population graph at 1 to start
with.
Chooses 5 numbers and puts
them in the array B(1) to B(5).
Checks which is biggest and
changes M to correspond
withit.

70 FOR 1=1 TO 5
80 LET B<I)=INT(RND*10+1)
90 IF B(I)>B(M) THEN LET M=I
100 NEXT I
110 CLS
120 FOR 1=1 TO 5
130 PRINT I;
Prints the S numbers on the
140 FOR J=1 TO B(I)
screen in the form ofrows of
150 PRINT "**";
stars.
160 NEXT J
170 PRINT
180 NEXT I
190 FOR 1=1 TO G*3
Checks ifyou are pressing a
T5200 LET I*=INKEY*
key and goes to 270 ifyou are.
210 IF I*<>"" THEN GOTO 270
220 NEXT I
Ifyou didn't press in time,
230 PRINT "TOO LATE"
prints TOO LATE and goes
240 FOR J=1 TO 10
< back for next go.
250 NEXT J
Checksifthe key you
260 GOTO 280
pressed was correct and, if
270 IF VAL(I*>=M THEN LET S=S+1
so, increases your score by 1.
280 NEXT G
' Goesbackforanothergo.
290 PRINT "YOU HIT ";S; " OUT OF 1 0 "
300 PRINT "HIGH DENSITY TARGETS"
Prints score after
3 1 0 I F S=10 THEN PRINT "YOU'RE A HERO'
10 goes.
320 IF S<10 THEN PRINT "TOUGH - YOU FAILE1
330 STOP

The above UstuigwiUwork.onaZX81. For


other computers, make the changes below,
1 0 , 1 1 0 HOME
1 0 , 1 1 0 PRINT CHR*<147>
8 0 LET B<I> = INTCRNDU>*10+1>
8 0 LET B < I > = I N T ( R N D < 0 > * 1 0 + 1 >
1 9 0 FOR 1 = 1 TO 6 * 3 0

1 9 5 I*=""
200 I*=INKEY*U>
2 0 0 SET I *
2 0 0 I F P E E K < - 1 6 3 8 4 ) > 1 2 7 THEN BET
2 4 0 FOR J = 1 TO 4 0 0

Changing the speed ofthe game


To give yourselfmore chance of
pressing a key each time, change the
last number in Une 190 to a higher one.
As your skiU improves, keep
lowering the number in Une 190. How
low can you go and stiU win?

Puzzlecorner
Can you work out how to make the
computer give you more than 5 targets
to choose from each time?

I*

Iceberg
Your huU is badIy damaged and
you've no weapons to speak of. As
youtimpslowly home through
treacherous iceberg-strewn waters,
you become aware that an enemy
ship is taUing you. Strangely it can
detect you but not the icebergs, so
your best chance is to lure it into
hittingone.
Your computer wiU print a grid
showing the position ofyour ship
(Y), the enemy (Z) and the icebergs
(*). You can move one space North,
South, East or West each go. The
enemy moves towards you by the
most direct route (it can move
diagonaUy too). Ifyou move into any
ofthe 8 positions surrounding the
enemy, you wUl be captured, and if
you hit an iceberg you wUl sink.
Can you escape?

*QU^Q*'J

How the program works


10 PRINT "ICEBERG'
20 DIM B(8,B) i i
* B A 3 0 LET N=INT<RND*8+4>

4 0 FOR 1=1 TO N
| s * B A B 5 0 LET B < I N T < R N D * 8 + l > , I N T < R N D * B + l > ) = 2 3
6 0 NEXT I

+ B A B 7 0 LET SX=INT(RND*8+1>
+ 8 0 LET SY=INT<RND*B+1>
9 0 IF B < S X , S Y ) 0 0 THEN BOTO 7 0
| s * B A B 1 0 0 LET B < S X , S Y ) = 6 3

*BA#110
+120
130
|s*BAB140
AB150
160
170
180
190
200
210
220
230
240
250

LET YX=INT(RND*8+1>
LET YY=INT(RND*8+1)
IF B ( Y X , Y Y ) 0 0 THEN 6 0 T 0
LET B<YX,YY>=62
CLS
FOR Y=1 TO 8
FOR X=1 TO 8
IF B < X , Y ) = 0 THEN BOTO 2 1 0
PRINT C H R * ( B ( X , Y ) ) ;
BOTO 2 2 0
PRINT " . " ;
PRINT " ";
NEXT X
PRINT
NEXT Y

110

This sets up the grid. B is an


"array"withtheDIMensions
8by8.
N is the number oficebergs.
It varies from 4 to 11
depending on the value of
RND.
23 on ZX81 and 42 on the
other computers is the code
for *. Computer loops round N
times putting * into random
positions in the grid.
This puts the enemy ship on
the grid for the start ofthe
game. 63 (ZX81) and 90
(others) are the codes for Z.
Checks the position has not
ah-eady been given to an iceberg
andfindsanotherifit has.
These Unes do the same as
above to put you on the grid.
(62 and 89 are the codes for
Y.)

* Prints out grid with current


positions ofships and
icebergs.

Puzzlecorner
Can you work out how to make the grid
bigger?
Now work out how to add more
icebergstoo.

MX~H

260 LET B<YX,YY)=0'


270 PRINT "DIRECTION (N,S,E,W)
280 INPUT D*

(S

290
29
300
0
32
320

LET
LET
LET
LET

YY=YY+<D*="S"
YY=YY-(D*="N"
YX=YX+(D*="E"
YX=YX-(D*="W"

AND
AND
AND
AND

if

YY<>8)
YY<>1)
YX<>8)
YX<>1)

1
I

Js**A#330 IF B(YX,YY)=63 THEN BOTO 500


|a*lA*340 IF B<YX,YY>=23 THEN GOTO 600

|s*BA#350 LET B(YX,YY))=62T


=
360 LET B(SX,SY >=0 J"

:}

370 LET SX=SX+SBN(YX-SX)


380 LET SY=SY+SGN<YY-SY)

|s**A390 IF B<SX,SY>=62 THEN BOTO 500


|s*>A*400 IF B<SX,SY>=23 THEN BOTO 700

>}

ls*BA*410 LET B<SX,SY)=63


420
500
510
600
610
700
800

SOTO 150 . i - - - i i - - i i - i i - i
PRINT "YOU'VE BEEN CAUBHT"
BOTO 800
PRINT. "YOU'VE HIT AN ICEBER6"
BOTO 800
PRINT "YOU'RE SAFE - HE'S HIT ONE"
STOP

The above tisting wiU work on a ZX81. For


other computers, make the changes below.
*A*30,50,70,80,110,120 change RND to RND(i>
30,50,70,80,110,120 change RND to
rtA#50,340,400 change 23 to 42
100,330,410 change 63 to 90
^140,350,390 change 62 to 89
150 PRINT CHR*(147);
150 HOME
LET YY=YY-<D*="S" AND YY<>8)
LET YY=YY+(D*="N" AND YY<>1>
*{
LET YX=YX-<D*="E" AND YX<>8>
LET YX=YX+(D*="W" AND YX<>1)

Clears your current position


from the grid so you can
specify a new one.
Puts your direction in DS.
Calculates your new
position, checking that you
don't go over the edge of the
grid.
Checks your new position to
see ifyou have bumped into
the enemy ship or an iceberg.
Ifyouhave, itjumpsdownthe
program to tell you.
You've moved to a safe
. position and the code for your
shipisputthere.
Calculates the enemy's new
position.
Checks enemy's new position
to see ifhe has caught you or
hit an iceberg. Jumps down
program to teIl you if he has.
Enemy's code is put in the
newposition.
End of a turn. Loops back to
ISO to start another turn.
Computers can decide
whether an expression is true'
or false. Ifthe answer is false
they give it the value 0. Ifit
istrue,somecomputersgive
/ thevalue+l,others-l.
Lines 290-320 have to be
changedforsomecomputers ]
.because ofthis.

TheWizard'sWall
The waU the Wizard built to surround his secret stronghold is no ordinary
waU. The stones in it are people, petrified by the Wizard's angry stare, and,
what's more, it can move. Ifyou can break a hole through it with yourtrusty
catapults which fling gigantic boulders, you wiU destroy the Wizard's
magic powers and turn the stones back into people again. There are
problems though - the Wizard is working on a speU which stops missiles in
mid-air and sends them back where they came from. Sometimes he can
make it work...
Ifyou don't succeed, you wiU become just another stone in the Wizard's
WaU!!!!
Aio CLS
20 PRINT "WIZARD'S WALL"
30 PRINT
40 PRINT "DO YOU WANT ANY HELP?"
50 INPUT I*
A60 IF I*<l>="Y" THEN GOSUB 740
70 PRINT "DIFFICULTY?"
80 PRINT "<5=EASY, l=DIFFICULT)"
90 INPUT Q
100 DIM W(8,8)
110 DIM E(8)
120 FOR Y=1 TO 8
130 FOR X=1 TO 4
**A#l40 LET W<X,Y>=20
150 NEXT X
160 NEXT Y
170 LET Z=0
180 FOR C=1 TO 3
190 LET D=INT(RND*80+21)
200 GOSUB 430
210 IF Z=1 THEN GOTO 1150
220 PRINT "YOU ARE ";D5" YARDS AWAY"
*"A#230 LET W=INT(RND*41)-20
240 IF W=0 THEN PRINT "NO WIND"
250 IF W<0 THEN PRINT "WIND TO RIGHT"
260 IF W>0 THEN PRINT "WIND TO LEFT":
270 PRINT "GIVE ELEVATION (1-90)"
280 INPUT A
290 PRINT "GIVE SPEED"

300
310
320
330
340
350
360
*"A370
380
390
400
410
420
*BA*430
440
450
460
470
480
*BA*490
500
510
520
530
540
550
560
*"A#570
*BA*580
590
600
A610
620
630
640
650
660
670
680
690
700
710

INPUT V
LET A=A/lSO*3.1416
LET H=TAN<A>*<D-W)-<5*<D-W)^2>/<V*C0S(A> > A 2
LET H=INT<H/Q)
IF H>0 AND H<9 THEN GOSUB 540
IF H<1 THEN PRINT "SHOT WAS TOO NEAR'
IF H > 8 THEN PRINT "SHOT WAS TOO FAR"
IF RND>.2 THEN GOTO 200
PRINT "THE WALL HAS MOVED..."
NEXT C
PRINT "YOU HAVE BEEN TURNED"
PRINT "INTO STONE"
STOP
FOR 1=1 TO 30
NEXT I
CLS
PRINT
FOR Y=8 TO 1 STEP -1
FOR X=1 TO 8
PRINT CHR*<W<X,Y)>;
NEXT X
PRINT
NEXT Y
RETURN
GOSUB 650
LET W(E<H>-1,H)=0
IF V*COS(A)>50 THEN LET W(E(H>-2,H)=0
I F R N D > . 5 AND H < > 1 THEN LET

W<E(l),l)=29

IF RND>.5 AND H>5 AND H<8 THEN LET


W(E(H+1)-1,H+1>=0
IF H>1 THEN GOTO 630
FOR Y=2 TO 8
IF RND<.5 THEN LET W<E<Y>-1,Y>=0
NEXT Y
GOSUB 650
RETURN
FOR Y=1 TO 8
LET X=1 '
IF W(X,Y)=0 OR X=8 THEN GOTO 700
LET X=X+1
GOTO 670
LET E(Y)=X
IF X=1 THEN LET Z=1

'

TheWizard's Wallcontinued
720 NEXT Y
730 RETURN
740 PRINT "YOU ARE ATTACKING THE"
750 PRINT "LAST STRONGHOLD OF THE"
760 PRINT "NOTORIOUS WIZARD, WHO"
770 PRINT "IS HIDDEN BEHIND AN"
780 PRINT "ENDLESS STONE WALL,"
790 PRINT "EACH STONE BEING ONE"
800 PRINT "OF HIS FORMER VICTIMS."
810 PRINT "ONLY YOU CAN ATTACK,"
820 PRINT "AND FREE THEM FROM"
830 PRINT "HIS MAGIC."
840 PRINT "YOU MUST DESTROY THE"
850 PRINT "WALL USING CATAPULTS,"
860 PRINT "BUT BEWARE, THE WIZARD"
870 PRINT "HAS THE POWER TO MOVE"
880 PRINT "THE WALL BACK AND"
890 PRINT "FORTH, AND OCCASIONALLY,"
900 PRINT "TO DEFLECT YOUR SHOTS"
910 PRINT "BACK AT YOU."
920 GOSUB 1110
930 PRINT "AFTER EACH SHOT, YOU ARE"
940 PRINT "SHOWN A CROSS-SECTION"
950 PRINT "OF THE WALL, SHOWING"
960 PRINT "HOW MUCH DAMAGE THERE"
970 PRINT "IS. "
980 PRINT "NOTE THERE ARE CERTAIN"
990 PRINT "KEY STONES THAT PRODUCE"
1000 PRINT "LOTS OF DAMAGE, AND"
1010 PRINT "ALSO, THE FASTER THE"
1020 PRINT "BOULDER IS MOVING"
1030 PRINT "HORIZONTALLY, THE MORE"
1040 PRINT "DAMAGE IT WILL CAUSE."
1050 PRINT "CAN YOU DEFEAT THE"
1060 PRINT "WIZARD IN TIME TO SAVE"
1070 PRINT "THE THOUSANDS OF TRAPPED"
1080 PRINT "SOULS
"
1090 GOSUB 1110

llOO
lllO
1120
1130
1140
1150
1160
1170
1180
1190
1200

RETURN
PRINT "PRESS A KEY ";
IF INKEY*="" THEN GOTO 1120
CLS
RETURN
PRINT "YOU MANAGED TO BREAK"
PRINT "A HOLE IN THE WIZARD'S"
PRINT "WALL - YOU HAVE BEATEN"
PRINT "HIS MAGIC POWERS, AND"
PRINT "FREED HIS VICTIMS."
STOP

The above listing will work on a ZX81. For


other computers, make the changes below.

all RND to RND(0)


all RND to RND(1)
10,450,1130 HOME
10,450,1130 PRINT CHR*(147);
60 IF LEFT*<I*,l)="Y" THEN GOSUB 740
140 LET W(X,Y)=29
430 FOR 1=1 TO 200
430 FOR 1=1 TO 1000
490 PRINT CHR*(W(X,Y)+32);
1120 I*=GET*
1120 GET I*
1120 GET I* : IF I*="" THEN GOTO 1120

Changes you can make to the game


You can make the wall thicker by changing the following lines:
Line 100: change thefirstnumber to a higher one, say, 10.
Line 130: subtract 4 from the number you used in line 100 and put the
answer at the end ofline 120. (i.e. in this case use 6.)
Line 480: change the last number to the number you used in line 100(10
again in this case).
Ifyou make the wall much thicker, you will probably need more time.
Change the last number in line 180 to a higher number to do this.

Missile!
This game is different from tne
others in this book because it uses
graphics. As the computers vary so
much in the way their graphics
work, there is a separate -rogram
for each one. Read the infructions
on this page for how to play the
game and then look through the
pages that follow for the version for
| 1 yourcomputer.

How to play Missile!


You have three missile bases, eaci
capable oflaunching one missile.
When you see a plane approaching,
you must judge its height and speed
and fire your missiles at it one by
one.
Your missiles are launched by
pressing any key. The first time you
press launches the left-hand one,
second time the middle one and
third time the right-hand one.
See how many enemy planes you
can shoot down.

Missile!: TRS-80 version


320 IRETURN
lO CLS
20 DIM Y(3),F(3)
400 IFOR J=1 TO 3
30 N=1
410 :SET (J*32,47)
420 SET (J*32+l,47)
40 PS=INT(RNDfO)*3+l)
430 NEXT
50 P=INT<RND<0)*36+5>
440 IRETURN
60 GOSUB 400
70 FOR I=PS TO lOO STEP PS
I SO GOSUB 300
| 90 F*=INKEY$
lOO IF F*="" OR N>3 THEN 130
110 F(N>=1
120 N=N+1
130 FOR J = 1 TO ^.
140 RESET(32*J,46-Y(J)>
150 IF F(J)=O OR Y(J>>45 THEN 190
I 160 Y(J)=Y(J)+1
170 IF POINT(32*J,46-Y(J)) THEN 230
180 SET (32*J,46-Y(J))
190 NEXT
200 NEXT
( 210 PRINT @0,"MISSED"
| 220 END
| 230 PRINT @ 0 , " H I T ! M "
! 240 END
300 RESET (I-PS,P) : RESET (I-PS+1,
310 SET (I,P) : SET (I+l,P)

Missile!: BBC version


10 MODE 5
20 VDU 23,224,224,160,144,144,143,128,128,255
30 VDU 23,225,0,0,0,0,240,12,2,255
40 VDU 23,226,16,56,84,16,16,16,0,0
50 VDU 23,227,0,0,0,8,8,8,8.60
60 DIM Y<3),F(3)
70 N=l:MS=16
80 PS=RND(20)+10
90 P=RND<500)+400
100 PROCDISPLAY
110 FOR I=PS TO llOO STEP PS
120 PROCPLANE<I-PS,P,O) : PR0CPLANE(I,P,3)
130 F*=INKEY*<O>
140 IF F*="" OR N>3 THEN 170
150 F(N>=TRUE
160 N=N+1
170 FOR J=1 TO 3
ISO IF NOT F(J) THEN 240
190 PROCMISSILE(J,0)
200 Y<J)=Y(J>+MS
210 IF Y<J)<1024 THEN PROCMISSILE(J,3)
220 X=J*320-I : Y=Y<J)+32-P
230 IF X<128 AND X>-40 AND Y>-32 AND Y<2 THEN
240 NEXT
250 NEXT
260 CLS s PRINT "MISSED!!!!"
270 END
280 PROCPLANE(I,P,l> : SOUND 0,-15,5,20
290 END
300 DEF PROCPLANE(X,Y,C>
310 GCOL O,C
320 MOVE X,Y
330 VDU 5,224,225,4
340 ENDPROC
350 DEF PROCMISSILE(N,C)
360 GCOL O,C
370 MOVE 320*N,32+Y(N>
380 VDU 5,226,4
390 ENDPROC
400 DEF PROCDISPLAY
410 FOR 1=1 TO 3
420 MOVE 1*320,32
430 VDU 5,227,8,226,4
440 NEXT
450 ENDPROC
|

31

Missile!: ZX Spectrum version


lO CLS
460 FOR j = I TO 3
15 INVERSE O
470 PRINT AT 21,8*j;"CAB3'
20 DIM y(3>
480 NEXT j
30 DIM f(3>
490 RETURN
40 LET n=l
500 DATA 0,0,0,0,255,255,
50 LET ms=8
7,63
60 LET ps=INT(RND*6+5)
510 DATA
0,252,252,252,
510
DATA 0,252,252,252,
70 LET p=INT(RND*140+20>
255,255,254,252
255,255,254,252
80 GOSUB 400
90 FOR i=ps TO 240 STEP ps
lOO LET c=l : LET x=i-ps
110 GOSUB 300
120 LET c=0 : LET x=i
130 GOSUB 300
140 LET f*=INKEY*
150 IF f*="" OR n>3 THEN GOTO 170
160 LET f<n>=l : LET n=n+l
170 FOR j=l TO 3
180 LET c=l : GOSUB 350
190 IF f<j>=0 OR y(j)>148 THEN GOTO 240
200 LET y(j)=y(j>+ms
210 LET c=0 : GOSUB 350
220 LET x=j*64-i : LET y=p-y<j>
230 IF x>-l AND x<12 AND y<10 AND y>-5 THEN GOTO 280
240 NEXT j
250 NEXT i
260 PRINT AT 0,0;"Missed"
270 STOP
280 PRINT AT 0,0;"HitM!"
290 STOP
300 INVERSE c
310 PLOT x,p
320 DRAW 0,8 : DRAW 3,-6
330 DRAW 8,0 : DRAW 2,-2
340 DRAW -13,0 : RETURN
350 INVERSE c
360 PLOT 64*J+4,Y<J)+4
370 DRAW 0,6 : DRAW -2,-2
380 DRAW 2,2 : DRAW 2,-2
390 RETURN
400 FOR a=65 TO 66
410 FOR b=0 TO 7
420 READ c
430 POKE USR CHR*(a>+b,c
440 NEXT b
450 NEXT a

32

Missile!: VIC20 version


10 PRINT CHR*<147>CHR*(5>;
20 POKE 36879,8
60 DIM Y(3>,F(3>
70 N=l:MS=2
90 P=INT<RND(l>*9+2>*2
llO FOR 1=1 TO 21 STEP RND<l)/2+-5
120 GOSUB 300
130 GET F*
140 IF F*="" OR N>3 THEN 170
150 F(N)=-1
160 N=N+1

FOR J=1 TO 3
IF F(J)=O THEN 220
POKE 8164+J*5-Y<J>*22,32
IF Y<J)=22 THEN 240
Y(J)=Y<J)+1
POKE 8164+J*5-Y(J)*22,30
IF ABS(I-J*5)<=1 AND P=Y(J) THEN 280
NEXT
NEXT
PRINT CHR* <147);"MISSED! ! ! i"
END
PRINT CHR*(147>;"HIT!H!"
POKE 36877,220 : POKE 36878,15
FOR K=1 TO 500 : NEXT
POKE 36877,0 : POKE 36878,0
END
POKE 8163+I-P*22,32
POKE 8164+I-P*22,121
RETURN

Special note for Spectrum users:


The convention used for showing graphics
characters in a PRINT statement ;i5 as fol
The character C means press the GRAPHICS
key once. Then type the following letter
keys (shifted for the ZX81). Press the
GRAPHICS key again when D is shown.

Missile!: Apple version


10 HOME
20 HGR
30 HCOLOR=3
40 DIM Y(3),F(3)
50 N=1 : MS=5
60 PB=INT(RND(1)*6+4)
70 P=INT<RND(1>*135+11>
BO GOSUB 400
90 FOR I=PS TO 265 STEP PS
100 X=I-PS : Y=159-P : C=0 : GOSUB 300
110 X=I : C=3 : GOSUB 300
120 F*="" : IF PEEK<-16384>>127 THEN GET F$
130 IF F*="" OR N>3 THEN 160
140 F(N)=1
150 N=N+1
160 FOR J=1 TO 3
170 C=0 : GOSUB 350
180 IF F(J)=0 OR YCJ)>145 THEN ^r>
190 Y(J)=Y(J)+MS
200 C=3 : GOSUB 350
210 X=J*70-I : Y=P-Y(J)
220 IF X>-1 AND X<15 AND Y>-9 AND Y<5 THEN 270
230 NEXT
240 NEXT
250 VTAB 22 : PRINT "MISSED"
260 END
270 VTAB 22 : PRINT "HIT!!
"HIT!!!"
280 END
300 HCOLOR=C
310 HPLOT X,Y TO X,Y-8
320 HPLOT TO X+3,Y-2 : HPLOT TO X+12,Y-2
330 HPLOT TO X+14,Y : HPLOT TO X,Y
340 RETURN
350 HCOLOR=C
o
360 HPLOT 70*J,158-Y(J) TO 70*J,154-Y(J)
370 RETURN
400 FOR J=1 TO 3
410 HPLOT 70*J-5,159 TO 70 .
420 NEXT
430 RETURN

34

Missile!: ZX81 version


10 CLS
20 DIM Y(3)
30 DIM F(3)
40 LET N=1
50 LET P=INT<RND*19+2)*2
r
60 FOR 1=1 TO 48
70 PLOT I,P
80 PLOT I+l,P
90 UNPLOT I-l,P
100 LET B$=INKEY$
110 IF B*="" OR N>3 THEN GOTO 140
120 LET F(N)=1
130 LET N=N+1
140 FOR J=1 TO 3
150 IF F(J)=0 THEN GOTO 190
160 UNPLOT J*16,Y(J)
170 IF Y(J)=42 THEN GOTO 210
180 LET Y(J)=Y(J)+1
190 PLOT J*16,Y(J)
200 IF P=Y(J) AND (J*16=I OR J*16=I+1)
THEN GOTO 260
210 NEXT J
220 NEXT I
230 CLS
240 PRINT "MISSED"
250 STOP
260 CLS
270 PRINT "HIT"
280 STOP

j|
4ifc.:-"-

J
'-"3fcfe
35

Adding to the programs


Here are some ideas for additions
Making the computer
you can make to the programs in
stop and wait for you
this book or to your own programs.
In most cases you won't be able to
add these to a ZX81 with only lKas
Ifyour instructions are very long, you
the games themselves fill almost all
may want to insert this sub-routine
its memory space, but you should
which
stops the program running at a
find there is plenty of room on the
particular
point until you press a key.
other computers.
This way you can stop the instructions
Remember you will either have to
scrolling offthe top ofthe screen
restrict your additions to the spare
before you have read them. Put a
line numbers in a program or
GOSUB line at the place you want the
renumber the program. Ifyou
program to stop and then put this subdecide to renumber, take care you
routine at the end.
change all the GOTO and GOSUB
1000 PRINT "PRESS A KEY TO CONTINUE
lines too.
SZX1010 IF INKEY*="" THEN BOTO 1010
*1010 I*=GET*
Getting the computer to tell you #1010 GET I*
THEN GOTO 1010
IF I*=
AlOlO GET I*
howtoplay
1020 PRINT
1030 RETURN
You can add a
sectiontoany
Making the computer "talk" to
programtomake
the computer print
you
instructions telling
you what to do. The
easiest way to do
this is to add some lines, such as those
below, at the beginning ofthe
program and then put a sub-routine at
the end.
10
11
12
15
SZX17
*BA#17

PRINT "TITLE OF GAME"


PRINT "DO YOU WANT TO"
PRINT "KNOW HOW TO PLAY?"
INPUT It
IF I*(l)="Y" THEN GOSUB lOOO
IF LEFT*<It,l)="Y" THEN GOSUB 1000

main program goes here


1000 PRINT "WHAT YOU HAVE TO"
1010 PRINT "DO IS
'
1V99 RETURN

You can make the computer ask you


questions and react to your answers.
For instance, here is an addition which
will make the computer refuse to play
with you unless your name begins with J.

1
2
3
3
You can add as many print statements
4
5
as you like for the instructions, just
6
remember to put a number and the
SZX7
word PRINT at the beginning ofeach*i A 7

36

one. Restrict the length of the part


inside the quotation marks to the
number of characters your computer
can print on one line. Don't forget to
put a RETURN line at the end or the
program won't work.

PRINT "WHAT IS YOUR NAME?"


INPUT I*
IF I*(1)<>"J" THEN GOTO 1000
IF LEFT*<I*,1)<>"J" THEN GOTO 1000
PRINT "OK-YOU CAN PLAY."
PRINT "ARE YOU READY?"
INPUT J*
IF J*(1)<>"Y" THEN GOTO 5
IF LEFT*(J*,1)<>"Y" THEN GOTO 5

main program here


1000
1010
1020
1030

PRINT
PRINT
PRINT
PRINT

SORRY THIS GAME IS"


'ONLY FOR PEOPLE"
'WHOSE NAMES BEGIN
WITH J"

Here is another one where the


computer dares you to be brave
enough to play.
10
12
14
15
16
S ZX17
17
IB
19

PRINT "VERY SCAREY GAME"


PRINT "ARE YOU BRAVE ENOUGH"
PRINT "TO TACKLE THE GREEN"
PRINT "HAIRY MONSTER?"
INPUT I*
IF I*<1>="Y" THEN GOTO 20
IF LEFT*(IS,1)="Y" THEN BOTO 20
PRINT "COWARD"
STOP

You could combine this with the


instruction sub-routine by taking lines
11 to 17 from the instructions section
on this page and putting them at lines
20 to 26 ofthis program. You canthen
start the main program at line 30 and
add the instruction sub-routine at the
end.

cases you can add a single line to your


program at the place you want the
sound. In others, you need several
lines and it is best to put these in as a
sub-routine.
As an example, here is the sound of
a shot for the BBC. You can experiment
with where to put it in the program, but
you must give it a line number to make
it worK:
SOUND

0,-15,5,10

At the back of the VIC manual ybu


will find some useful sub-routines for
sounds such as "laser beam",
"explosion" and "red alert". Put a
GOSUB line where you want the sound
to appear, number the sub-routine and
add a RETURN at the end ofit.

Would you like another go?


Instead of typing RUN each time you
play a game, you can make the
computer ask you if you'd like another
go. Put these lines at the end ofthe
program, just before the last STOP
statement.
lOOO
1010
SZX1020
*BA#1020
1030
1040

PRINT "DO YOU WANT ANOTHER GO?


INPUT I*
IF I*<l>="Y" THEN RUN
IF LEFT*(I*,l)="Y" THEN RUN
PRINT "OK THEN - BYE"
STOP

Change line
numbers according
to your program.

Adding sound effects


The BBC, VIC 20, ZX Spectrum and
some Apples are able to produce
sounds and you can add lines to your
programs tomake them do so at
appropriate places. You could add an
explosion for instance, or a little tune
which plays if you win. All the
computers need different instructions
to make sounds though, so you will
have to look at your manual. In some

SpecialnoteforBBCand
Spectrumusers

^^
^W^

If you have a BBC or a ZX Spectrum


you may find that some of the games
in this book run too fast for you. You
will find a box next to these games
containing instructions for
changingthe speed. Remember, to
slow the game up you always need
to use a higher number. Later
models of the BBC may run up to
twice as fast as the earlier models,
and this could make the games
appear impossible on the first run.
Be prepared to make big changes
to the speed number to correct this.
37

Writing your own programs


As you work through the games in
the book, you will probably find
yourselfmaking more and more
changes to them and eventually
wanting to write new games ofyour
own. On these two pages you will
find some hints on how to set about
doingthis.
Before you start, it is a good idea to
stop and think about what your
computer can and cannot do.

*It can store information

*It can ask you for information.

*It can select numbers at random by


using RND.

*It can do calculations.

*It cannot do anything unless you tell it


to.
*It can make decisions by comparing
items of information in various ways.

38

*It can tell you the results ofits


calculations and decisions and also
what is stored in its memory.

*Provided you use its language


correctly, it can do only exactlywhat
you tell it, even if it is silly.
Remember, when you are trying to
work out a game, nofto include
anything which your computer won't
be able to do.

Planningagame

Writing the program

Before you can tell the computer how


to play your game, you must know
exactly how to play it and what the
rules are yourself. The computerwill
need a series of simple logical
instructions, so work out your game in
your head or on paper first and then
break it down into simple steps.
Next write a plan (in English - don't
try to use BASIC yet) of all the stages of
the game in order.
Here is a plan for a simple shooting
game, such as firing cannon balls at a
pirate ship or shooting laser beams at
an alien invader, to give you an idea.

The next stage is to convert your plan


into BASIC. Each step in your plan may
need several lines in BASIC. Don't
forget to leave gaps when numbering
your program lines so you can go back
and add extra ones if you need to.
Do a first draft of the program on
paper first and then start testing on the
computer. Your computer will spot
errors much more quickly than you
will see them yourself and may give
you a clue as to what is wrong.
Remember that debugging programs
is a long, tedious process even for
expert programmers, so don't expect
to get yours right first time.

~~TT~x^nrT~?nr~?rF

PLAN
2)

PRlNTTlTLEMD
INSTRUCTIONS

2) CHOOSE A TARCET
FORTHl5 GAME
3)BECilN A LOOP TO
GIVE THE PLAYER
N COES
4-) CiET A SHOT FROM
THE

PLAYEH

5) CHECK IF SNOT WAS


ON TARQEJ
6) PRINT MESSAGE
DEPENDING ON
ACCURACY
OFSHOT
7) <f0 8ACK FOR
ANOTMR qo \F SHOT
WAS UNSUCCESSFUL

Once you have got the core of the


program working, you can add to it.
Scoring, extra comments, more
targets etc. can all be incorporated
later. You could add sections from the
programs in this book to your games.
Don't expect to be able to write
exciting and original games straight
away. Keep your ideas very simple
and be prepared to,adapt them as you
go along. You may find you have
included something in your game
which is easy for humans to do but
very difficult for a computer. As you
get more experienced you will begin
to know instinctively what your
computer can do and find it easier to
write programs for it.

39

SummaryofBASIC
This section lists some common BASIC words and describes what they
make the computer do and how they are used. Most ofthem have beenused
in the programs in this book, so you can check back through the book to see
how they work in a game. Not all the words can be used on allthe
computers mentioned iri this book. The conversion chart on page 46 shows
whatyoucanuseinstead.
LET tells the computer to label a section ofits
memory and put a particular value in it e.g. LET
A=6 means label a section of memory "A" and put
the value 6 in it. "A" is called a "variable" andputting
something in it is called "assigning a value to a
variable".
Some variable labels are followed by a dollar
sign e.g. A$. This means they are for "strings",
which can contain any number ofcharacters,
including letters, numbers and symbols.
PRINT tells the computer to display things on the
screen and you can use it in several ways:
A message enclosed in quotation marks with
PRINT in front of it will be displayed on the screen
exactly as you typed it. The section inside quotes
does not have to be in BASIC, it can be anythingyou
like.
PRINT followed by a variable label e.g. PRINT A
or PRINT A$ tells the computer to displaythe
contents ofthat variable on the screen.
PRINT can also do calculations and then display
the results e.g. PRINT 6*4will make the computer
display 24.
You can use PRINT by itself to leave an empty
line.
RND tells the computer to choose a number at
random. Different computers use different forms of
RND and you can see what these are in the
conversion chart on page 46. On Sinclair computers
D by itselfproduces a number between 0 and
99999999. You can vary the limits of the number it
chooses by multiplying RND and adding to it. E.g.
RND*20 produces a number between 0 and
19.99999999, while RND*20+1 producesanumber
between 1 and20.99999999.
See INT for how to produce only whole numbers.
See CHR$ for how to produce letters and other
keyboard characters at random.

INT is short for integer, which means whole


number. For positive numbers, it tells the computer
to ignore everything to the right of the decimal
point. E.g. INT(20.999) is 20. For negative numbers,
it ignores everything to the right ofthe decimal
point and "increases" the number to the left of it by
onee.g.INT(-3.6)is-4.
INT is often used with RND, like this:
INT(RND*20+1) which tells the computer youwant
it to choose a whole number between 1 and 20.
CHR$ converts numbers into letters. Apart fromthe
ZX81, all the computers in this book use the
ASCII*set ofkeyboard characters in which each
character corresponds to a certain number. E.g.
letter A has the code number 65 and PRINT
CHR$(65) will display an A on the screen.
You can use CHR$ with INT and RND to make the
computer select random letters, like this:
CHR$(INT(RND*26+65))
This line will produce random letters on a ZX
Spectrum (see conversion chart forother
computers).
FOR is used to start a "loop" which will make the
computer repeat part of a program a certain
number oftimes. It must be followed byavariable
(such as G to stand for the number of goes allowed
in a game), and the variable must be given start and
end values (such as 1 TO 10.)
The end ofthe loop is marked by a NEXT line
(NEXT G in this example) which increases the value
ofthe variable by 1 each time and then sends the
computer back to the FOR line again. When the
variable reaches its end value, the computer
ignores the NEXT line and carries on to the line
which follows it. Every FOR must have a NEXT or
youwiUgetabug.
INPUT labels a space in the computer's memory,
prints a question mark and then waits for you to
type something which it can put in this memory
space. It will not carry on with the rest ofthe
program until you press RETURN, ENTER or
NEWLINE.
You can use number or string variables with
INPUT, but if you use a number variable the
computer will not accept letters from you.
*American Standard Code forInformation Interchange (seepage 45)

INKEY$ checks the keyboard to see if a key is


being pressed and if so which one. It does not wait
for you to press a key like INPUT does. It is usually
used in a loop which makes the computer go round
checkingthe keyboard lots oftimes. This is
because computers work so quickly, you wouldn't
have a chance of pressing a key in the time it takes
the computer to do one check.
Ifyou haven't pressed a key before the loop
finishes, the computer carries on with a string
containing nothing (called a "null" string).
NB Apple and VIC do not use INKEY$.
GET is used instead of INKEY$ on VIC and Pet
computers.
GOTO makes the computer jump up or down the
program ignoring the lines in between. You must
put the number of the line you want it to jump to
afterthe GOTO instruction.
GOSUB tells the computer to leave the main
program and go to a sub-routine. GOSUB must be
folowed by the number ofthe first line ofthe subroutine. At the end of the sub-routine you must have
a RETURN line. This sends the computer back to
the main program to the line immediately following
the GOSUB line. A GOSUB without a RETURN in a
program will give a bug.
IF... THEN tells the computer to decide ifan
expression is true or false, and do differentthings
depending on the answer. It is used with the
following signs, and also with AND or OR:
=thesameas
<lessthan
>greaterthan
<=less than or the same as
> = greater than or the same as
<>notthesameas
Ifthe computer decides an expression is true, it
carries on to do the instruction which follows
THEN. Ifit decides it is false, it ignores the restof
that line and goes on to the next one.

CLS is used to clear everything offthe screen


without removing or changing anything in the
memory. It is useful for removing the listing from
the screen at the beginning of a RUN or in games
when you want the player to react to something
seen for a limited amount oftime. (NB Apple and
VIC do not use CLS - see conversion chart).

HOME is used by Apple computers instead ofCLS


to clear the screen.

ABS ignores plus and minus signs in front of


numbers and takes their "absolute" values. E.g.
ABS( -10) is 10 and ABS( +10) is also 10.

VAL takes the numeric value of numbers written as


strings. In effect, it tells the computer to ignore the
dollar sign and treat the string as an ordinary
numbervariable. E.g. ifI$="60"thenVAL(I$)isthe
number 60.

ASC converts a character into its ASCII code


numbere.g. ASC("3") gives 51. The expressionin
brackets must be a string e.g. ASC(A$) or
ASC("20").
NB ZX81 and ZX Spectrum do not use ASC, though
the Spectrum does use the ASCII code.

CODE is used by ZX81 and Spectrum in place of


ASC. Like ASC it must always be followed bya
string. Remember that the ZX81 uses different code
numbers from the other computers.

TAB moves the cursor across the screen to a


specified column number. It is usually used with
PRINT to display something in the middle ofthe
screen. The number of spaces you want the cursor
moved is put in brackets after TAB. The maximum
number you can use depends on the screen width
of your computer.

SGN tells the computer to find out the sign ofa


number. It produces - 1 for a negative number, 0
for zero and +1 for positive numbers. E.g.
SGN(-30)is - 1 , SGN(7)is +1 andSGN(0) isO.
DIM tells the computer how much memory space
will be needed for an "array" (a row or a grid). E.g.
DIM X(6) tells the computer to set aside an area
large enough to contain a row of 6 elements and
labelled X. DIM A(8,8) means a memory space
labelled A and big enough to take 8 elements
across and 8 down is needed. The number of
elements of data used in the program must
correspond to the numbers in brackets after DIM
or you will get a bug.
SQRtakes square roots ofnumbers. E.g. SQR(16)
gives the answer 4.
SIN calculates the sine of an angle. In a right-angled
triangle the length ofthe side opposite anangle,
divided by the length ofthe Hypoteneuse (the side
opposite the right angle) is the sine ofthatangle.
When you use SIN in a program, the angle you are
using it with must be measured in radians, not
degrees.
ATN is one ofthe trig, functions whichcomputers
can calculate (see also SIN above). It stands for
arctangent and it is important to remember that it
gives an answer in radians, not degrees. Youwill
need to use a maths book to find out how this works
ifyou do not already know about it.
STOP tells the computer not to go any further in a
program. Computers other than the ZX81 can use
END instead.
PEEK is a way of finding out what is in a specific
area of the computer's memory. You need to use it
with a number which specifies an "address" inthe
memory.
NBnotusedonBBC.
POKE is a special way ofputting information inthe
computer's memory by using a memory "address'.
NBnotusedonBBC.

ASCII chart
Code
number

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

ASCII
character

space
1
>)
#
$
%
&
i

(
)
*

+
i

I
0
12
3
4
5
6
7
8
9
:
i

<
=

ZX81 code chart


Code
number

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

ASCII
character

>
>

(a)
A
B
C
D
E
F
G
H
I

K
L
M
N
O
P

R
S
T
U
V
W
X
Y
Z

Code
number

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

ZX81
character

Code
number

19

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

$
'

?
(
)
>
<

I
i

>

0
1
2
3
4
5
6
7
8
9
A
B
C

ZX81
character

D
E
F
G
H
I
T
K
L
M
N
O
P

oR
S
T
U
V
W
X
Y
Z

Chart of screen sizes


Max. number of
characters across
(or number of columns)

Max. number of
lines down
(or number of rows)

VIC 20

22

23

TRS-80

64

16

BBC

20/40/80

16/24/32

ZX81

32

22

ZX Spectrum

32

22

Apple

40

25

r^

Conversion chart
This quick reference chart shows some ofthe variations in the BASIC used by the machines in this book. Itdoes
not include instructions for graphics, sound or colour as these vary so enormously from machine tomachine.
Note also that although most computers (except the BBC) use PEEK and POKE, they do not use the samesystem
ofmemory addresses, so the numbers used with PEEK and POKE must be changed for eachcomputer.

Select random
number between 0
and 0.99999999
Select random
number between 1
andN
Select random letter
between A and Z

BBC

VIC/Pet

Apple

TRS-80

ZX Spectrum

ZX81

RND(1)

RND(1)

RND(1)

RND(0)

RND

RND

RND(N)

RND(1)*N+1

RND(1)*N+1

RND(N)

RND*N+1

RND*N+1

CHR$(INT(RND(1)
CHR$(RND(26)+64) CHR$(INT(RND(1)
*26+65))
*26+65))

CHR$(RND(26)+64) CHR$(INT(RND * 26+65))CHR$(INT(RND*26+38))

CLS

PRINT CHR$( 147)

HOME

CLS

CLS

CLS

Check keyboard to
see if key being
pressed

INKEY$(N)

GETX$

X$=" "
IF PEEK(-16384)
> 127 THEN GET X$

INKEY$

INKEY$

INKEY$

Convert characters
into code numbers

ASC("X")
(using ASCII code)

ASC("X")
(using ASCII code)

CODE("X")
(using ASCII code)

CODE("X")
(using ZX81 code)

Clear screen

ASC("X")
ASC("X")
(using ASCII code) (using ASCII code)

Move cursor up

PRINT CHR$( 11)

PRINT CHR$( 145)

CALL-998

PRINT CHR$(27)

PRINT CHR$( 11)

PRINT CHR$( 112)

Move cursor down

PRINT CHR$( 10)

PRINT CHR$( 17)

PRINT CHR$( 10)

PRINT CHR$(26)

PRINT CHR$( 10)

PRINT CHR$( 113)

Move cursor left

PRINT CHR$(8)

PRINT CHR$( 157)

PRINT CHR$(8)

PRINT CHR$(24)

PRINT CHR$(8)

PRINT CHR$( 114)

Move cursor right

PRINT CHR$(9)

PRINT CHR$(29)

PRINT CHR$(21)

PRINT CHR$(25)

PRINT CHR$(9)

PRINT CHR$( 115)

LEFT$(A$,N)

LEFT$(A$,N)

LEFT$(A$,N)

LEFT$(A$,N)

A$(lTON)

A$(1T0N)

RIGHT$(A$,N)

RIGHT$(A$,N)

RIGHT$(A$,N)

RIGHT$(A$,N)

A$(NTO )

A$(NTO )

MID$(A$,N1,N2)

MID$(A$,N1,N2)

MID$(A$,N1,N2)

MID$(A$,N1,N2)

A$(NlTON2)

A$(NlTON2)

Take 1 st N
characters of string
Take last N
characters of string
Take middle N
characters of string

<fi
<t

Answers
You mayfindthat your answers to
some ofthe puzzles are different to
the ones given here. As long as they
work on your computer then this
doesn't really matter, but check to
see ifthey are as neat and simple as
the answers in the book.
Page5
Robot Missile
Line 90 teUs the computer how many
times to loop round and get a guess
from you. So, for more chances of
guessing the secret code letter,
change the last number intine90 to a
higher one. For less chances, change
ittoalowerone.
Page7
The Vital Message

Page 11
Desert Tank Battle
Add the following lines to the program
to add the possibitity ofthe robots
seeingyou:
175 IF RND<.05 THEN GOTO 250
250 PRINT "THEY'VE SEEN YOU-AABG6HHHH"
260 STOP

Change the RND in tine 175 to the


version your computer needs. You can
change .05 to any number between 0
and 0.999, but remember that the
higher the number you put here the
greater the chance ofthe robots
seeingyou.
Page13
Battle at Traitor's Castle

hi this program, tines 150 and 160 are a This is a difficult puzzle, so dont worry
"delay" loop. They make the computer ifyou couldn't do it. Try out the answer
anyway. Add thesetinesto get the two
dd nothing for a certain length oftime
targets.
before going on to the next instruction
in the program which is to clear the
55 LET P=INT(RND+.5)*4+l
messageoffthescreen.Tomakethe szx57 LET p*=cHR*<p+5i>
messagestayonthescreenlonger, *mA*% ^ ^ T r a ^ L E R*=R*+P*
youneedtomakethecomputerloop
iso LET s=s+p
round more times. You can do this by
changing the last number in tine 150 to
a higher one.
Page 15
Robot Invaders
Page9
You can get 100 points for U, V, W, X or
Shootout
Y and 10 points for the others by
making these changes.
To make it possible for the computer
to miss too, add the foUowingtinesin
220 LET H=H+10
addition to those in the 'Making the
225 IF P*>"T" AND P*<"Z" THEN LET
H=H+90
game harder" box.
155 IF RND<.1 THEN GOTO 250
250 PRINT "HE SHOOTS BUT MISSES"
260 GOTO 90

Line 155 may need RND(1) or RND(0),


depending on your computer.

Page17
SecretWeapon
You can add the scoring system in the

puzzle by putting these extra Unes into


the program.
15 LET S=0
145 IF Z<=3 THEN LET S=S+1
190 GOTO 217
215 LET S=S+10
217 PRINT "YOU SCORED ";Sj" POINTS"

Page19
Escape!
This is the simplest way to add three
robots to the game, though it makes
the game rather difficult to win.
22 FOR R=1 TO 3
25 PRINT "ROBOT "jR
300 NEXT R
310 STOP

Page21
Pirate Dogfight
To make your chance ofhittingthe
pirate equal to his chance ofhitting
you, change the .7 in line 290 to .5.

Page23
Supersonic Bomber
To get more targets each time, change
the 5 in lines 30,70 and 120 to a higher
number. You must put the same
number in aU three Unes.
Page25
Iceberg

48

You can make the grid bigger by


changing aU the 8s in Unes 20,50,70,
80,110,120,160,170,290and310toa
bigger number. (Use the same
number each time.)
To add more icebergs change the 4
inUne30toahighernumber.

Goingfurther
Here is a Ust of books you should
find useful if you want tofindout
more about computers or writing
programs.
Usborne Guide to Computers by
Brian Reffin Smith, Usborne
Understanding the Micro by
Judy TatcheU and Bill Bennett,
Usborne
bitroduction to Computer
Programming by Brian Reffin
Smith, Usborne
niustrating BASIC by Donald
Alcock, Cambridge University
Press
Fred Learns about Computers,
Macdonald & Evans
The BASIC Handbook by David
A. Lien, Compusoft PubUshing
The Computer Book by Robin
Bradbeer et al, BBC PubUcations

First pubUshed in 1982 by


Usborne Publishing Ltd, 20
Garrick Street, London WC2E
9BJ, England.
1982 Usborne PubUshing Ltd
The name Usborne and the
device # are Trade marks of
Usborne PubUshing Ltd.
AU rights reserved. No part of
this publication may be
reproduced, stored in a retrieval
system or transmitted in any form
or by any means, electronic,
mechanical, photocopying,
recording or otherwise, without
the prior permission ofthe
pubUsher.

Printed in Spain by
ELEXPURU, S. A. L.-Bilbao

Usborne Computer Programs Each ofthese colourful new books contains 14 simple games programs to
play on a microcomputer.* Alongside the programs there are
explanations of how they work and puzzles and suggestions for ways of
changing them. Through playing these games even complete beginners
wiU quickly begin to understand how a simple program works and be
itching to write their own. There are tips and hints on writing programs
and a summary of BASIC at the back ofeach book and aJso a chart which
wiU help you convert programs in magazines and other books to work on
your micro.
*The programs in these books are suitable for use on the foUowing
micros: ZX81, BBC, TRS-80, VIC 20, Pet, Apples which use PalsoftBASIC
andZXSpectrum.
\
tT
_____
COMPuTR

Other Computer Titles


,

*rraoouCTONTO-^^

COMPUTER
PROGRAMMING
^Agutd*tor>tMotatet>*ginmri

A colourful guide to
microcomputers, how
they work and what they
can do, with lots of ideas
for things you can do
with a micro.

A step-by-step guide to
progxanuning in BASIC
for absolute beginners.
With lots of programs to
runonany
microcomputer.

A colourful look at how


computers play Space
Invaders, chess and
other games, with lots of
tips on how to beat the
computer.

PubUshed in Canada by Hayes Pubhshing Ltd, 3312 Mainway, Buriington, Ontario, Canada, L7MlA7.
PubUshed in the USA by Hayes Books, 4235 South Memorial Drive, Tuka, Oklahoma, USA.

KBN0 86020 685 8

Printed in Spain by ELEXPURU, S. A . L . - B i l b a o

You might also like