100 REM originally PAINT DUEL by Lloyd Johnson 7/81 Creative Computing p.186
110 REM for h19-h89 with MBASIC 5.2
120 REM adapted by Karen E. Harman 8/4/81
130 RANDOMIZE(7)
140 WIDTH 80
150 DIM B(15,15)
160 S$=CHR$(27):PRINT S$;"E":PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT TAB(25);"N E U T R O N   T A N K S"
170 PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT
180 FOR TIME=1 TO 3000:NEXT TIME:PRINT S$;"E":PRINT:PRINT:PRINT"Instructions ";
190 INPUT A$
200 PRINT S$;"E":PRINT:PRINT:PRINT
210 IF LEFT$(A$,1)="Y" OR LEFT$(A$,1)="y" THEN 220 ELSE 630
220 PRINT "		  It is the year 2001, Ronald Reagan is 90 years old
230 PRINT "		and has just been elected to his 5th term as King of
240 PRINT "                the United States. As Doomsday looms, he sends Al
250 PRINT "		(I'm number three) Haig to Moscow to try to iron out
260 PRINT "		the SALT II treaty. As Haig gets off Air Force 3, he
270 PRINT "		makes some comment about how Brezhnev's wife has the 
280 PRINT "		same hairdo as his toy poodle, and it's war....
290 PRINT
300 PRINT "		  Because of the previous wars of Siberia, Altoona,
310 PRINT "		Kruschevgrad, and Beverly Hills, both the U.S. and
320 PRINT "		the U.S.S.R have only a single antiquated tank, armed
330 PRINT "		with neutron warheads. You are the only one who has
340 PRINT "                evolved so little that you still have fingers to push
350 PRINT "		'the button.' It is thus your mission to destroy the
360 PRINT "		the Red threat that is trying to deprive you of your
370 PRINT "		freedom to cheat the IRS and watch 'Charlie's Angels'
380 PRINT "		as is the 'American Way.' Go out and get that dude !!!!
390 PRINT:PRINT
400 LINE INPUT "Return when ready: ";R$
410 PRINT S$;"E"
420 PRINT:PRINT:PRINT:PRINT
430 PRINT "		  You will be furnished with a computer that will show
440 PRINT "		you a 9x9 grid which will represent your 9 square mile
450 PRINT "		battlefield. Initially, the Russian knows your present
460 PRINT "		position which is (8,5). All you know of his position
470 PRINT "		is that it is located somewhere on the first row. You 
480 PRINT "		have the option of shooting or moving, but if you shoot,
490 PRINT "		your opponent's radar will get a fix on you as your's
500 PRINT "		can with his tank. A neutron bomb landing in a sector
510 PRINT "          	will emit high levels of radiation for a long enough
520 PRINT "		time to preclude either you or your nemesis from enter-
530 PRINT "		ing it. Both you and the Russian make your moves without
540 PRINT "		the other's knowledge of your plans.
550 PRINT:PRINT:PRINT:PRINT:PRINT:LINE INPUT "Return when ready: ";R$
560 PRINT S$;"E":PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT "     The computer commands available are as follows:
570 PRINT"     ";:FOR CV=1 TO 47:PRINT"=";:NEXT CV:PRINT:PRINT
580 PRINT TAB(20);"M :         EXECUTE MOVE OPTION
590 PRINT TAB(20);"S :         EXECUTE SHOOT OPTION
600 PRINT TAB(20);"D :         DISPLAY LANDSCAPE
610 PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:LINE INPUT "Return when ready: ";R$
620 PRINT CHR$(27);"E"
630 FOR I=1 TO 9
640 FOR J=1 TO 9
650 B(I,J)=0
660 NEXT:NEXT
670 R4=8:C4=5:B(R4,C4)=2:R1=8:C1=5:R2=1:C2=INT(9*RND(1))+1:B(R2,C2)=1:D1=0:D2=0:F1=0:F2=0:T1=0:T2=0:A=0:M1=0:R9=1
680 REM
690 T1=T1+1
700 GOSUB 800
710 IF M1=1 THEN 740
720 GOSUB 1220
730 GOTO 750
740 GOSUB 1330
750 GOSUB 1470
760 GOSUB 2330
770 GOSUB 2560
780 IF (D1+D2)=0 THEN 690
790 GOTO 2790
800 REM
810 GOSUB 860
820 GOSUB 980
830 GOSUB 1090
840 GOSUB 1150
850 RETURN
860 REM
870 N2=0
880 N=T1-T2
890 FOR I=-N TO N
900 IF R1+I<1 OR R1+I>9 THEN 960
910 FOR J=-N TO N
920 IF C1+J<1 OR C1+J>9 THEN 950
930 IF B(R1+I,C1+J)=4 THEN 950
940 N2=N2+1
950 NEXT J
960 NEXT I
970 RETURN
980 REM
990 N1=0
1000 FOR I=-1 TO 1
1010 IF R2+I<1 OR R2+I>9 THEN 1070
1020 FOR J=-1 TO 1
1030 IF C2+J<1 OR C2+J>9 THEN 1060
1040 IF B(R2+I,C2+J)=4 THEN 1060
1050 N1=N1+1
1060 NEXT J
1070 NEXT I
1080 RETURN
1090 IF F1<F2 OR RND(1)>.25 THEN 1120
1100 A=0
1110 GOTO 1140
1120 IF F1>F2 OR RND(1)>.25 THEN 1140
1130 A=20
1140 RETURN
1150 REM
1160 P=50-M1*40-5*(9-N1)+2.5*(ABS(9-N2)+9-N2)+A
1170 IF RND(1)*100>P THEN 1200
1180 M1=1
1190 GOTO 1210
1200 M1=0
1210 RETURN
1220 REM
1230 I=INT(RND(1)*3)-1
1240 IF R2+I<1 OR R2+I>9 THEN 1230
1250 J=INT(RND(1)*3)-1
1260 IF C2+J<1 OR C2+J>9 THEN 1250
1270 IF B(R2+I,C2+J)=4 THEN 1230
1280 B(R2,C2)=B(R2,C2)-1
1290 R2=R2+I
1300 C2=C2+J
1310 B(R2,C2)=B(R2,C2)+1
1320 RETURN
1330 REM
1340 F1=F1+1
1350 IF RND(1)>.35 OR N>1 THEN 1380
1360 I=0:J=0
1370 GOTO 1430
1380 I=INT(RND(1)*(2*N+1))-N
1390 IF R1+I<1 OR R1+I>9 THEN 1380
1400 J=INT(RND(1)*(2*N+1))-N
1410 IF C1+J<1 OR C1+J>9 THEN 1400
1420 IF B(R1+I,C1+J)=4 THEN 1380
1430 IF R1+I=R2 AND C1+J=C2 AND N2>1 THEN 1380
1440 R3=R1+I
1450 C3=C1+J
1460 RETURN
1470 REM
1480 PRINT:PRINT:PRINT CHR$(27);"Y";"%":PRINT:PRINT "Turn #"T1:PRINT"---------":LINE INPUT "Enter command (M,S,D): ";A$:PRINT CHR$(27);"J";
1490 IF A$<>"M" THEN 1530
1500 PRINT
1510 GOSUB 1640
1520 GOTO 1590
1530 IF A$<>"S" THEN 1560
1540 GOSUB 1900
1550 GOTO 1590
1560 IF A$<>"D" THEN 1610
1570 PRINT
1580 GOSUB 2110
1590 IF R9=0 THEN 1630
1600 GOTO 1480
1610 PRINT"Invalid command.":PRINT
1620 GOTO 1480
1630 RETURN
1640 REM
1650 R9=1
1660 PRINT:PRINT "Enter coordinates of sector: ";
1670 INPUT I,J
1680 IF ABS(R4-I)<2 AND ABS(C4-J)<2 THEN 1720
1690 PRINT
1700 PRINT"  You can only move one square. Shape up !!
1710 PRINT:GOTO 1890
1720 IF I>0 AND I<10 AND J>0 AND J<10 THEN 1760
1730 PRINT
1740 PRINT"Are you chicken or something ? You are not allowed to leave the battlefield"
1750 GOTO 1890
1760 IF I=INT(I) AND J=INT(J) THEN 1800
1770 PRINT
1780 PRINT"  Invalid coordinates.":PRINT
1790 GOTO 1890
1800 IF B(I,J)<4 THEN 1840
1810 PRINT
1820 PRINT"  Movement into areas of high radioactivity is foolish and not permitted.
1830 PRINT:GOTO 1890
1840 B(R4,C4)=B(R4,C4)-2
1850 R4=I
1860 C4=J
1870 B(R4,C4)=B(R4,C4)+2
1880 R9=0
1890 RETURN
1900 REM
1910 R9=1
1920 PRINT
1930 INPUT "Enter coordinates of sector: ";I,J
1940 IF I>0 AND I<10 AND J>0 AND J<10 THEN 1990
1950 PRINT "  Are trying to radiate innocent citizens ? ...no shots off landscape
1960 PRINT
1970 PRINT
1980 GOTO 2100
1990 IF I=INT(I) AND J=INT(J) THEN 2030
2000 PRINT
2010 PRINT"Bad coordinates. Try again.:?
2020 GOTO 2100
2030 R5=I
2040 C5=J
2050 T2=T1
2060 F2=F2+1
2070 R9=0
2080 R1=R4
2090 C1=C4
2100 RETURN
2110 REM
2120 R9=1
2130 PRINT "  ";
2140 FOR I=1 TO 9
2150 PRINT USING "##";I;
2160 NEXT I
2170 PRINT
2180 FOR I=1 TO 9
2190 PRINT USING "##";I;
2200 FOR J=1 TO 9
2210 IF B(I,J)>1 THEN 2240
2220 B$="."
2230 GOTO 2280
2240 IF B(I,J)<>4 THEN 2270
2250 B$="X"
2260 GOTO 2280
2270 B$="H"
2280 PRINT" ";B$;
2290 NEXT J
2300 PRINT
2310 NEXT I
2320 RETURN
2330 REM
2340 IF T1=T2 THEN 2380
2350 PRINT
2360 PRINT"Move completed. New position: ";R4;C4
2370 GOTO 2550
2380 PRINT
2390 PRINT"Your shot will kill anyone in sector"R5;C5"."
2400 PRINT"The enemy tankman has identified your position."
2410 PRINT:PRINT
2420 IF B(R5,C5)>0 AND B(R5,C5)<4 THEN 2450
2430 B(R5,C5)=4
2440 GOTO 2550
2450 REM
2460 IF B(R5,C5)=2 THEN 2510
2470 PRINT
2480 PRINT"You have killed your opponent with your neutron bomb."
2490 FOR BEEP=1 TO 24:PRINT CHR$(7);:FOR TIME =1 TO 500:NEXT:NEXT
2500 D1=1
2510 IF B(R5,C5)=1 THEN 2550
2520 PRINT
2530 PRINT"You have carelessly (and stupidly) bombed your sector.":PRINT"You will die within minutes....."
2540 D2=1
2550 RETURN
2560 REM
2570 IF M1=1 THEN 2620
2580 IF D1=1 THEN 2780
2590 PRINT
2600 PRINT:PRINT
2610 GOTO 2780
2620 PRINT
2630 PRINT"*****The computer has fired a shot from"R2;C2"."
2640 PRINT"       This has contaminated all of sector"R3;C3"."
2650 FOR TIME=1 TO 1000:NEXT
2660 IF B(R3,C3)>0 AND B(R3,C3)<4 THEN 2680
2670 B(R3,C3)=4:GOTO 2780
2680 REM
2690 IF D2=1 THEN 2780
2700 D2=1
2710 PRINT
2720 PRINT"The computer has bombed your sector and the radiation is having 
2730 PRINT"an immediate affect. You have failed your country."
2740 FOR BEEP=1 TO 2000:PRINT CHR$(7);:NEXT BEEP
2750 IF B(R3,C3)=2 THEN 2780
2760 PRINT:PRINT"The Russian has typically made a mistake and bombed his own region."
2770 D1=1
2780 RETURN
2790 REM
2800 IF D1+D2<2 THEN 2830
2810 PRINT:PRINT "TIE WAR -- You have both been killed.":PRINT"Oh well, I guess it's back to the bargaining table !!"
2820 GOTO 2880
2830 IF D1=0 THEN 2860
2840 PRINT:PRINT"You win. Your country is proud of you. You have saved Apple pie !!"
2850 GOTO 2880
2860 PRINT
2870 PRINT"The enemy wins. Well, I guess it's Vodka for breakfast, comrade."
2880 PRINT:PRINT:PRINT:PRINT "Do you want to try again ";:INPUT A$
2890 PRINT CHR$(27);"E"
2900 IF A$="Y" THEN 630
2910 IF A$="N" THEN 2930
2920 PRINT:GOTO 2880
2930 PRINT CHR$(27);"E":PRINT:PRINT:INPUT "Back to CP/M ";K$:IF K$="Y"THEN SYSTEM ELSE END
" THEN 2930
2920 PRINT:GOTO 2880
2930 PRINT CHR$(27);"E":PRIN