The Best of Creative Computing Volume 1 (published 1976)

Page 263 << PREVIOUS >> NEXT Jump to page:
Go to contents Go to thumbnails

Seawar (BASIC program listing)

graphic of page

LIST
SEAWAR
I0 	PRINT "YOU COMMAND A FLEET SHIPS OPERATING  IN ENEMY TERRITORY!!!".

20 	PRINT "DO YOU NEED INSTRUCTIONS"

30 	DIM QS [12]
40 	INPUT QS
50	IF QS = "YES" THEN 90
60	IF QS= "NO"  THEN 170
70	PRINT "INPUT  'YES' OR  'No' " 
80	GOTO 40
90	PRINT "YOU TELL YOUR GUN CREWS THE ELEVATION TO SET THEIR GUNS." 100 PRINT
"ELEVATION IS IN DEGREES FROM 0 TO 360."

11|9 	PRINT "YOUR TASK FORCE CONSISTS OF 3 DESTROYERS, 2 CRUISERS,"

120	PRINT "2 BATTLESHIPS, AND 2 HEAVY AIRCRAFT CARRIERS."

130	PRINT "THE ENEMY HAS 9 SHIPS FOR HIS DEFENSE." 
140	PRINT "IF YOU SUCCEED IN SINKING ALL HIS SHIPS BEFORE HE SINKS" 
150	PRINT "YOURS, YOU HAVE WON. HOWEVER, IF HE SINKS ALL YOUR SHIPS"

160	PRINT "BEFORE YOU HAVE DEFEATED HIM, YOU HAVE LOST!!"

170	PRINT "LET US BEGIN!!!"

180	DIM Z$[20], D$[40], I$[10], P$[72], M$[40], N$[40]
190	A=O=S1=S2=S=P1=P2=P4=0
200	REM SELECTS NAME OF ENEMY SHIP
210	PRINT ""

220 	READ Z$
230	A=A+1
240	GOTO 320
250	RESTORE
260	IF O=9 OR A=9 THEN 840
270	FOR X=1 TO A
280	READ Z$
290	NEXT X
300	READ Z$
310	A=A+1
315	REM SELECTS BATTLE MODE
320	IF Z$= "AIRCRAFT CARRIER" THEN 390
330	IF Z$= "U-BOAT" THEN 2000
340	IF Z$= " TORPEDO BOAT" THEN 360
350	LET P=1
360 	GOTO 400
390	RESTORE
399	REM BEGINS BATTLE WITH SIGHTING AND READING
400	PRINT
405	PRINT "YOUR FLAGSHIP REPORTS THE SIGHTING OF AN ENEMY ": Z$
410	T=43000.-3000*RND(0)*RND(0)*10)*.987654*102
420	IF T<10000 THEN 410
430	S=P2=0
440	T=INT (T)
450	IF Z$="U-BOAT" THEN 2030
460	PRINT USING 470;T
470	IMAGE "YOUR INSTRUMENTS READ THE RANGE TO THE TARGET AS ", DDDD
475	PRINT "METERS."

480	IF P=1 THEN 1480
490	IF S>4 THEN 510
500	GOTO 540
505	REM AFTER 5 TRYS BY US TARGET MOVES OUT OF RANGE
510	PRINT "ALL RIGHT, BAD SHOT, THE TARGET HAS MOVED OUT OF"

520	PRINT "RANGE !!! LET'S TRY IT AGAIN !!!"

525	S1=S1+S
530	GOTO 320
535	REM INPUT ANGLE OF ELEVATION
540	PRINT "WHAT ELEVATION ** ";
550	ENTER 7,L,B
551	PRINT
560	IF L -256 THEN 590
570	PRINT "          ADMIRAL  !! YOU HAVE TO BE FAST IN THIS GAME!!"

580	GOTO 1590
590	PRINT "----FIRE !!!"

600	S=S+1
620	IF B>360 THEN 1410
630	IF B<0 THEN 750
640	IF B=0 THEN 770
650	IF B=90 THEN 980
660	IF B>330 THEN 770
670	IF B>180 THEN 1370
680	IF B>150 THEN 1300
690	IF B>90 THEN 1020
699	REM DISTANCE FROM TARGET CALCULATED
700	V1=675.285
705	E=INT(T-(V1"2/9.80665*SIN(2*B/57.3)))
710	IF ABS(E) <= 100 THEN 1050
720	IF E>100 THEN 1200
730	IF E<=100 THEN 1250
740	REM "GOOF" SHOTS
750	PRINT "GUN BACKFIRED, KILLING CREW!"

760	GOTO 820
770	PRINT "WHAT ARE YOU TRYING TO DO?  KILL SOME FISH?  THE SHELL"

780	PRINT "EXPLODED UNDER WATER FIFTY METERS FROM YOUR SHIP!!!"

790	GOTO 1590
820	PRINT "               ADMIRAL PLEASE  !!!!"

830	GOTO 1590
839	REM PEACE AND WINNER
840	PRINT "                        ********   PEACE   *********
850	PRINT
860	PRINT
870	PRINT
880	PRINT USING 890;S1,S2
890	IMAGE "YOU FIRED ",DD," ROUNDS.    THE ENEMY FIRED ",DD,"  ROUNDS."

900	IF 0=9 THEN 920
910	IF A=9 THEN 950
920	PRINT "ALL OF YOUR SHIPS HAVE BEEN SUNK.      SO SORRY"

930	PRINT "THE BATTLE IS OVER………….YOU WIN !!!!"

940	GOTO 2220
950	PRINT "YOU HAVE DECIMATED THE ENEMY………. THAT'S NICE"

960	PRINT "THE BATTLE IS OVER ………….YOU WIN !!!!"

970	GOTO 2220
975	REM "GOOF" SHOTS
980	PRINT "YOU IDIOT!! YOU SHOT STRAIGHT UP!!, AND THE SHELL"

990	PRINT "LANDED ON YOUR OWN GUN POSITION, DESTROYING IT!!!"

1000	GOTO 1590
1020	PRINT "HEY STUPID, YOU'RE FIRING ON YOU OWN SHIPS!!!"

1030	GOTO 1090
1040	REM ENEMY SHIP SUNK
1050	IF Z$="U-BOAT" THEN 1070
1060	GOTO 1090
1070	PRINT "DEPTH CHARGE EXPLORED RIGHT ON TOP OF THAT BABY!!!"

1080	GOTO 1100
1090	PRINT " ** BOOM **"

1100	PRINT ""

1110	M$="TARGET DESTROYED!!!          **"

1120	N$="  **    ROUNDS EXPENDED."

1130	PRINT SUING 1140;M$,SN$
1140	IMAGE 26A,D,21A
1141	PRINT USING 1142;0,A
1142	IMAGE "YOU HAVE LOST    ",D," SHIPS,  AND THE ENEMY HAS LOST   ",D," "."

1150	S1=S1+S
1160	P=0
1190	GOTO 250
1200	IF Z$="U-BOAT" THEN 2130
1210	PRINT USING 1220;ABS(E)
1220	IMAGE "SHOT FELL ",5D" METERS SHORT OF TARGET."

1230	GOTO 1590
1250	IF Z$="U-BOAT" THEN 2160
1260	PRINT USING 1270;ABS(E)
1270	IMAGE "SHELL OVERSHOT TARGET BY ",6D," METERS."

1280	GOTO 1590
1300	REM "GOOF" SHOTS
1310	PRINT "  YOU SHOT A PROJECTILE, INTO THE AIR,"

1320	PRINT "  IT FELL TO THE WATER, YOU KNOW NOT WHERE."

1330	PRINT "BUT I DO, YOU IDIOT, YOU JUST SANK YOUR OWN FLEET TANKER!!"

1340	S1=S1+1
1350	IF P=1 THEN 1590
1360	GOTO 490
1370	PRINT "WHAT ARE YOU TRYING TO DO?? DRILL A NEW HATCH?? THE SHELL"

1380	PRINT "EXPLODED IN YOUR SHIP, DESTROYING IT!!!"

1385	0=0+1
1386	IF 0=9 THEN 840
1390	IF P=1 THEN 1590
1400	GOTO 820
1410	PRINT "WHERE DID U LEARN TO TYPE?  ";B; *DEGRESS EXCEEDS 360 BY"

1420	PRINT B-360; "DEGREES."

1430	S1=S1+1
1440	IF P=1 THEN 1590
1450	GOTO 490
1480	PRINT " THE ENEMY ";Z$;" IS FIRING ON YOUR SHIPS!"

1490	P4=1234*RND(RND(0))*(RND(0)*10
1500	IF P4>500 THEN 1490
1510	IF P2=1 THEN 1600
1520	IF INT(P4)<100 THEN 1800
1530	IF Z$="U-BOAT" THEN 2100
1540	PRINT   USING 1550;INT(P4)
1550	IMAGE "HIS FIRST ROUND FELL  ",DDD," METERS SHORT."

1560	LET S2=S2+1
1570	GOTO 490
1590	IF P2=1 THEN 1490
1600	P1=1250*RND(RND(0))*(RND(0)*10)
1610	IF P1>P4 THEN 1600
1620	IF P1<(P4-400) THEN 1600
1630	IF P1<100 THEN 1710
1640	LET P4=P1
1650	S2=S2+1
1660	IF Z$="U-BOAT" THEN 2190
1670	PRINT USING 1680; INT(P1)
1680	IMAGE "THE ENEMY ROUND FELL ",DDD," METERS SHORT."

1700	GOTO 490
1710	S2=S2+1
1720	LET P2=1
1730	GOSUB 1850
1750	PRINT "THE ENEMY ";Z$;"    SANK   ";D$
1760	0=0+1
1770	IF 0=9 THEN 840
1780	IF D$="YOUR LAST BATTLESHIP!!" THEN 840
1790	GOTO 490
1800	P2=1
1810	GOSUB 1850
1820	PRINT "IN FACT, HE JUST SANK  ";D$
1830	0=0+1
1840	GOTO 1770
1850	RESTORE
1860	FOR C=1 TO (9+0)
1870	READ D$
1880	NEXT C
1890	READ D$
1920	DATA "U-BOAT", 210 MM SHORE GUN","70,000 TON CRUISER"

1930	DATA "BATTLESHIP","TORPEDO BOAT","HEAVY FRIGATE"

1940	DATA "E-TYPE DESTROYER","GUIDED-MISSILE SHIP","AIRCRAFT CARRIER"

1950	DATA "ONE OF YOUR DESTROYERS!!","YOUR HEAVY CRUISER!!"

1960	DATA "ANOTHER OF YOUR DESTROYERS!!","ONE OF YOUR BATTLESHIPS!!"

1970	DATA "YOUR LAST DESTROYER!!","YOUR AIRCRAFT CARRIER!!"

1980	DATA "YOUR LAST BATTLESHIP!!"

1990	RETURN
2000	PRINT "YOUR FLAGSHIP HAS DETECTED A U-BOAT APPROACHING AT  5";
2005	PRINT "FATHOMS."

2010	P=1
2020	GOTO 410
2030	PRINT "YOUR SUBMARINE DETECTION ON EQUIPMENT READS THE RANGE  TO THE":

2031	PRINT "TARGET"

2040	T*INT(T-1500)
2050	IF T<0 THEN 410
2060	PRINT SUING 2070;T
2070	IMAGE "AS  ",5D," METERS."

2080	PRINT "THE U-BOAT HAS COMMENCED FIRING TORPEDOES AT YOUR SHIP."

2090	GOTO 1490
2100	PRINT USING 2110;(INT(P4)-50)
2110	IMAGE "HIS FIRST TORPEDO EXPLODED ",3D," METERS BEHIND YOUR SHIP."

2120	GOTO 1560
2130	PRINT USING 2140; ABS(E)
2140	IMAGE "DEPTH CHARGE EXPLODED  ",4D," METERS SHORT OF TARGET."

2150	GOTO 1590
2160	PRINT USING 2170; ABS(E)
2170	IMAGE "DEPTH CHARGE EXPLODED  ",4D," METERS AFT OF TARGET."

2180	GOTO 1590
2190	PRINT USING 2200;(INT(P1)-50)
2200	IMAGE "THE ENEMY TORPEDO EXPLODED ",3D," METERS IN FRONT OF  YOUR"

2201	GOTO 490
2220	END
					263

Page 263 << PREVIOUS >> NEXT Jump to page:
Go to contents Go to thumbnails