Radio Shack TRS-80 PC-3 Owner's Manual page 202

Table of Contents

Advertisement

Northwest
7
West
4
Southwest
North
8
5
South
2
Northeast
9
East
6
Southeast
3
At random squares on the board there are "mines". If you enter a square with a mine, you lose. To help you avoid the mines, the
PC-3 Computer will beep as it enters a square. It will make one beep for each adjacent square with a mine, but it won't tell you the
direction. The program checks to insure that no mines are laid so close to the corners that it is difficult or impossible to start or
finish. You determine the number of mines by responding with a number in response to the question "DIFFICULTY?".
Notice the use of subroutines in this program to produce a short, simple main program with special functions isolated in separate
subroutines.
Minefield Game Program
10:S
~
10
20: DIM F (S + 1, S + 1)
30:
WAIT 128
40: INPUT "DIFFICULTY LEVEL? "; B
50: PRINT "ONE MINUTE FOR SETUP"
Set size of field to 10 by 10
Allocate array 1 larger in both directions - Extra size facilitates loop
at line
220
Set WAIT for 2 seconds
Ask for number of mines
Display warning about setup time
202

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents