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

Table of Contents

Advertisement

290:
IF «0 =
1)
OR (0 =
4)
OR (0 =
7))
THEN GOSUB
650
300:
IF (F(X, V) =
1)
THEN GOTO
700
310:
IF (F(X. V) =
9)
THEN GOTO
750
320:
GOTO
200
400:C
=
0
410:
FOR I = X -
1
TO X +
1
420:
FOR J = V -
1
TO V
+
1
430:
IF (F(I,J) =
1)
THEN LET
C
=
C
+
1
440:
NEXT J
450:
NEXT I
460:
RETURN
500:
IF (V =S) THEN PRINT
"VOU ARE AT NORTH EDGE" : GOTO
520
510: V
=
V + 1
520:
RETURN
550:
IF (V = 1) THEN PRINT
"VOU ARE AT SOUTH EDGE" : GOTO
570
560: V
=
V - 1
570:
RETURN
600:
IF (X =S) THEN PRINT
610:
"VOU ARE AT EAST EDGE" : GOTO
620
610: X
=
X
+
1
620:
RETURN
If from left side, then GOSUB to west subroutine
If new square contains a bomb, then GOTO losing message
If new square is the goal, then GOTO winning message
Otherwise loop
Mine counting subroutine
Set counter for mines
Loop through neighboring squares
If there is a mine, increment count by one
North subroutine
If at north edge, don't do anything
Move one square north
And return
South subroutine If at south edge, don't do anything
Move one square south
And return
If at east edge, don't do anything
Move one square east
And return
204

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents