Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
119 lines (105 sloc) 2.6 KB
100 POKE &HFFD9,0
110 REM ROBOT MINEFIELD
120 CLS : PRINT @32*8," PLEASE STAND BY ..."
130 GOSUB 590 : REM INIT
140 CLS
150 GOTO 350
160 REM MOVE ROBOTS
170 FOR E=1 TO 4
180 IF B(E) = -1 THEN 320 : REM THIS ROBOT IS DEAD
190 X=B(E) : Y=C(E)
200 IF B(E)<D THEN B(E)=B(E)+1
210 IF B(E)>D THEN B(E)=B(E)-1
220 IF C(E)<F THEN C(E)=C(E)+1
230 IF C(E)>F THEN C(E)=C(E)-1
240 IF B(E)<0 THEN B(E)=0
250 IF B(E)>12 THEN B(E)=12
260 IF C(E)<0 THEN C(E)=0
270 IF C(E)>12 THEN C(E)=12
280 A(X,Y)=46
290 IF A(B(E),C(E))=42 THEN TALLY=TALLY+1 : GOSUB 1030 : A(B(E),C(E))=46 : B(E) = -1 : GOTO 320 : REM ROBOT HIT MINE
300 IF A(B(E),C(E))=72 THEN A(B(E),C(E))=64 : GOSUB 400 : GOTO 900
310 A(B(E),C(E))=36
320 NEXT E
330 IF TALLY=4 THEN GOSUB 400:GOTO 970
340 RETURN
350 GOSUB 400:REM PRINT MINEFIELD
360 GOSUB 480:REM HUMAN MOVE
370 GOSUB 400:REM PRINT MINEFIELD
380 GOSUB 160:REM ROBOT MOVE
390 GOTO 350
400 REM PRINT MINEFIELD
410 PRINT @0, "DEAD ROBOT TALLY:";TALLY;
420 FOR B=0 TO 12
430 FOR C=0 TO 12
440 PRINT @32+B*32+C,CHR$(A(B,C));
450 NEXT C
460 NEXT B
470 RETURN
480 REM PLAYER MOVE
490 A(D,F)=46
500 A$=INKEY$
510 IF A$="" THEN 500
520 IF A$="N" AND D>0 THEN D=D-1
530 IF A$="S" AND D<12 THEN D=D+1
540 IF A$="E" AND F<12 THEN F=F+1
550 IF A$="W" AND F>0 THEN F=F-1
560 IF A(D,F)=42 THEN A(D,F)=88 : GOSUB 400:GOTO 990
570 A(D,F)=72
580 RETURN
590 REM INIT
600 DIM A(13,13),B(4),C(4)
610 TALLY=0
620 REM PLACE WALLS
630 FOR B=0 TO 12
640 FOR C=0 TO 12
650 A(B,C)=46
660 NEXT C
670 NEXT B
680 REM PLACE MINES
690 FOR B=1 TO 20
700 C=RND(13)-1
710 D=RND(13)-1
720 A(C,D)=42 : REM "*"
730 NEXT B
740 REM PLACE ROBOTS
750 FOR E=1 TO 4
760 D=RND(13)-1
770 F=RND(13)-1
780 IF A(D,F) <> 46 THEN 760
790 B(E)=D : C(E)=F
800 A(B(E),C(E))=36 : REM "$"
810 NEXT E
820 REM PLACE HUMAN
830 D=RND(13)-1
840 F=RND(13)-1
850 IF A(D,F)<>46 THEN 830
860 A(D,F)=72 : REM "H"
870 RETURN
880 REM HUMAN AT D,F
890 REM ROBOTS AT B(E),C(E)
900 REM END OF GAME
910 GOSUB 1010 : PRINT @0,"ROBOT GOT YOU!";
920 GOSUB 610
930 PRINT" <SPACE>";
940 IF INKEY$<>" " THEN 940
950 GOSUB 1010
960 GOTO 350
970 GOSUB 1010 : PRINT @0,"YOU GOT ALL ROBOTS!";
980 GOTO 920
990 GOSUB 1010 : PRINT@0,"RAN INTO MINE!";
1000 GOTO 920
1010 PRINT @0," ";
1020 RETURN
1030 SOUND 1,1
1040 P=32*(1+X)+Y : PRINT @P,"."; : REMOVE FROM OLD LOCATION
1050 P=32*(1+B(E))+C(E)
1060 PRINT @P,"/"; : GOSUB 1130
1070 PRINT @P,"-"; : GOSUB 1130
1080 PRINT @P,"\"; : GOSUB 1130
1090 PRINT @P,"*"; : GOSUB 1130
1100 PRINT @P,"+"; : GOSUB 1130
1110 PRINT @P,"."; : GOSUB 1130 : GOSUB 1130
1120 RETURN
1130 FOR I=0 TO 100:NEXT I:RETURN
1140 REM 46="." 72="H" 88="X" 36="$" 42="*"