home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Game Killer
/
Game_Killer.bin
/
054.WARGAME.BAS
< prev
next >
Wrap
BASIC Source File
|
1979-12-31
|
7KB
|
161 lines
1000 REM
1010 REM War Strategy Game by Randy Hawkins
1020 REM (c) Copyright 1989 by Randy Hawkins and
1030 REM ONE THOUSAND Magazine, All Rights Reserved
1040 REM
1042 COMMON RH: IF RH = 0 THEN SYSTEM
1044 CLEAR: KEY (17) ON: KEY 17, CHR$(0) + CHR$(1)
1046 ON KEY (17) GOSUB 2560
1050 SCREEN 0: WIDTH 80: KEY OFF: COLOR 15,0: CLS
1060 DIM N$(1), P(1,9), M(6), D(6): RANDOMIZE TIMER
1070 ON ERROR GOTO 2540
1080 M(1) = -19: M(2) = 1: M(3) = 20
1090 M(4) = 19: M(5) = -1: M(6) = -20
1100 PRINT "Welcome to OTM's War Strategy Game": PRINT
1110 INPUT "What is Player #1's Name"; N$(0): PRINT
1120 INPUT "What is Player #2's Name"; N$(1): PRINT
1130 PRINT SPC(2); "Hex Movement Chart": PRINT
1140 PRINT SPC(7); "6"; SPC(5); "1"
1150 PRINT SPC(9); CHR$(92); CHR$(32); CHR$(47)
1160 PRINT SPC(6); "5"; CHR$(32); STRING$(2,196);
1170 PRINT CHR$(250); STRING$(2,196); CHR$(32); "2"
1180 PRINT SPC(9); CHR$(47); CHR$(32); CHR$(92)
1190 PRINT SPC(7); "4"; SPC(5); "3": PRINT
1200 PRINT "Press any key to begin."
1210 WHILE INKEY$ = "": WEND: CLS
1220 REM
1230 REM Set Up User Defined Functions
1240 REM
1250 DEF FNZ(X) = INT(RND * X) + 1
1260 DEF FNR(X) = INT((X + 59.4) / 19.5)
1270 DEF FNC(X) = 4 * (X - INT(FNR(X) * 19.5)) + 237 - (FNR(X) AND 1) * 2
1280 DEF FNL(X) = SCREEN(FNR(X), FNC(X) + 1)
1290 REM
1300 REM Prepare Game Screen
1310 REM
1320 LOCATE 1,29,0: PRINT "OTM's War Strategy Game"
1330 COLOR 2,0: LOCATE 2,5: PRINT STRING$(71,220)
1340 LOCATE 18,5: PRINT STRING$(71,223)
1350 FOR A = 3 TO 17: LOCATE A,5: PRINT STRING$(71,219)
1360 NEXT A: COLOR 0,2: U$ = CHR$(250) + STRING$(3,32)
1370 FOR A = 3 TO 17: LOCATE A, 6 + 2 * (A AND 1)
1380 FOR B = 1 TO 17 - (A AND 1): PRINT U$;: NEXT B
1390 PRINT CHR$(250): NEXT A: U$ = CHR$(32) + CHR$(35) + CHR$(32)
1400 REM
1410 REM Place Armies and Capital Cities on Screen
1420 REM
1430 FOR A = 0 TO 1: COLOR 4 + A * 3, 7 - A * 3
1440 FOR B = 0 TO 9: READ X,Y: P(A,B) = X
1450 LOCATE FNR(X), FNC(X): PRINT USING U$; Y;: NEXT B,A
1460 DATA 43,3, 62,5, 81,5, 100,5, 119,3
1470 DATA 23,4, 42,4, 61,5, 80,4, 99,4
1480 DATA 172,3, 191,5, 210,5, 229,5, 248,3
1490 DATA 192,4, 211,4, 230,5, 249,4, 268,4
1500 COLOR 4,7: LOCATE 5,11: PRINT CHR$(32); CHR$(16); CHR$(32)
1510 COLOR 7,4: LOCATE 15,67: PRINT CHR$(32); CHR$(17); CHR$(32)
1520 REM
1530 REM Place Lake and Mountains on Screen
1540 REM
1550 COLOR 1,2: X = FNZ(291): IF FNL(X) <> 250 THEN 1550
1560 A = 0: FOR B = 1 TO 2: A = A + FNL(X+B) <> 250
1570 NEXT B: FOR B = 19 TO 22: A = A + FNL(X+B) <> 250
1580 NEXT B: FOR B = 39 TO 41: A = A + FNL(X+B) <> 250
1590 NEXT B: IF A THEN 1550 ELSE LOCATE FNR(X), FNC(X)
1600 PRINT STRING$(11,178);: LOCATE FNR(X)+1, FNC(X)-1
1610 PRINT STRING$(13,178);: LOCATE FNR(X)+2, FNC(X)
1620 PRINT STRING$(11,178);
1630 FOR A = 1 TO 2: COLOR 0,2
1640 X = FNZ(291): IF FNL(X) <> 250 THEN 1640
1650 LOCATE FNR(X), FNC(X) + 1: PRINT CHR$(127): B = 6
1660 Y = FNZ(6): C = FNL(X + M(Y))
1670 IF C <> 127 AND C <> 250 THEN 1660
1680 X = X + M(Y): LOCATE FNR(X), FNC(X) + 1: PRINT CHR$(127)
1690 B = B + (C = 250): IF B THEN 1660
1700 NEXT A: T = FNZ(2) - 1
1710 REM
1720 REM Begin Play; Each Player Moves Armies
1730 REM
1740 GOSUB 2410: I$ = "Your Turn, General " + N$(T)
1750 IF T = 0 THEN LOCATE 20,5: PRINT I$;
1760 IF T = 1 THEN LOCATE 20,76-LEN(I$): PRINT I$;
1770 FOR A = 0 TO 9: IF P(T,A) = 0 THEN 1960
1780 X = FNL(P(T,A)) - 48: Y = X: COLOR 2,0: LOCATE 22,18
1790 PRINT "Enter Direction to Move (1-6) or <P> to Pass"
1800 COLOR 2,0: LOCATE 20, 63 - T * 59: PRINT X; "Moves Left"
1810 COLOR 20+T*3, 7-T*3: LOCATE FNR(P(T,A)), FNC(P(T,A))
1820 PRINT USING U$; Y;: DEF SEG = 0: POKE 1050, PEEK(1052)
1830 I$ = INKEY$: IF I$ = "P" OR I$ = "p" THEN 1940
1840 IF I$ < "1" OR I$ > "6" THEN 1830
1850 B = VAL(I$): C = FNL(P(T,A) + M(B))
1860 REM
1870 REM Entering Capital? Valid Move?
1880 REM
1890 IF (T = 0 AND C = 17) OR (T = 1 AND C = 16) THEN 2460
1900 IF C <> 250 THEN 1830
1910 COLOR 0,2: LOCATE FNR(P(T,A)), FNC(P(T,A))
1920 PRINT CHR$(32); CHR$(250); CHR$(32);
1930 P(T,A) = P(T,A) + M(B): X = X - 1: IF X THEN 1800
1940 COLOR 4 + T*3, 7 - T*3: LOCATE FNR(P(T,A)), FNC(P(T,A))
1950 PRINT USING U$; Y;
1960 NEXT A: GOSUB 2410
1970 REM
1980 REM Check Each Army for Combat Situation
1990 REM
2000 FOR A = 0 TO 9: LOCATE 20,37
2010 PRINT "Stand By": IF P(T,A) = 0 THEN 2370
2020 C = 0: FOR B = 1 TO 6: X = P(T,A) + M(B): D(B) = -1
2030 FOR Y = 0 TO 9: IF X = P(1-T,Y) THEN C = C + 1: D(B) = Y
2040 NEXT Y,B: IF C = 0 THEN 2370
2050 F1 = FNL(P(T,A)) - 48: IF C > 1 THEN 2110
2060 B = 0: FOR C = 1 TO 6: IF D(C) => 0 THEN B = C
2070 NEXT C: GOTO 2170
2080 REM
2090 REM Select Direction of Attack
2100 REM
2110 I$ = "General " + N$(T) + ", Attach Which Direction (1-6)?"
2120 LOCATE 20, 40 - LEN(I$)/2: PRINT I$
2130 COLOR 20 + T*3, 7 - T*3: LOCATE FNR(P(T,A)), FNC(P(T,A))
2140 PRINT USING U$; F1;: DEF SEG = 0: POKE 1050, PEEK(1052)
2150 I$ = INKEY$: IF I$ < "1" OR I$ > "6" THEN 2150
2160 B = VAL(I$): IF D(B) < 0 THEN 2150
2170 F2 = FNL(P(1-T,D(B))) - 48: GOSUB 2410
2180 REM
2190 REM Combat Between Adjacent Armies
2200 REM
2210 LOCATE 20,34: PRINT "C O M B A T !"
2220 COLOR 20 + T*3, 7 - T*3: LOCATE FNR(P(T,A)), FNC(P(T,A))
2230 PRINT USING U$; F1;: COLOR 23 - T*3, 4 + 3*T
2240 LOCATE FNR(P(1-T,D(B))), FNC(P(1-T,D(B))): PRINT USING U$; F2;
2250 FOR C = 1 TO 25: NOISE 6,15,2: SOUND 1,2,0: NEXT C
2260 IF F1 + 1 < FNZ(F1 + F2) THEN 2320
2270 F2 = F2 - 1: IF F2 THEN 2220 ELSE COLOR 0,2
2280 LOCATE FNR(P(1-T,D(B))), FNC(P(1-T,D(B)))
2290 PRINT CHR$(32); CHR$(250); CHR$(32): P(1-T,D(B)) = 0
2300 COLOR 4 + T*3, 7 - T*3: LOCATE FNR(P(T,A)), FNC(P(T,A))
2310 PRINT USING U$; F1;: GOTO 2370
2320 F1 = F1 - 1: IF F1 THEN 2220 ELSE COLOR 0,2
2330 LOCATE FNR(P(T,A)), FNC(P(T,A))
2340 PRINT CHR$(32); CHR$(250); CHR$(32): P(T,A) = 0
2350 COLOR 7 - T*3, 4 + 3*T: LOCATE FNR(P(1-T,D(B))), FNC(P(1-T,D(B)))
2360 PRINT USING U$; F2;
2370 GOSUB 2410: NEXT A: T = 1 - T: GOTO 1740
2380 REM
2390 REM Clear Bottom of Screen
2400 REM
2410 COLOR 2,0: FOR C = 20 TO 23: LOCATE C,1
2420 PRINT STRING$(78,32);: NEXT C: RETURN
2430 REM
2440 REM Victor Has Entered Opposition Capital
2450 REM
2460 GOSUB 2410: I$ = "General " + N$(T) + " is the Victor!"
2470 LOCATE 20, 40 - LEN(I$) / 2: PRINT I$
2480 LOCATE 22, 24: PRINT "Do You Want to Play Again (Y/N)? _"
2490 I$ = INKEY$: IF I$ = "Y" OR I$ = "y" THEN 1044
2500 IF I$ = "N" OR I$ = "n" THEN 2560 ELSE 2490
2510 REM
2520 REM Error Trapping for BASIC w/o NOISE Statement
2530 REM
2540 IF ERL = 2250 THEN SOUND 100,.1: RESUME NEXT ELSE RESUME 2550
2550 PRINT "Error Code #"; ERR; "in Line Number"; ERL
2560 CLS: LOCATE 12,30: PRINT "One Moment Please...": RUN "menu"