forked from DigitalMars/Empire-for-PDP-10
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1.FOR
293 lines (269 loc) · 8.72 KB
/
1.FOR
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
C SUBROUTINE COLLECTION 1
SUBROUTINE STASIS(Z6,LOC)
INTEGER Z6
COMMON /IARROW/IARROW(0:9)
DO 100 I=1,8
BLAH=A(1,Z6+IARROW(I))
100 IF((BLAH>='1').AND.(BLAH<='8')) CALL CMYCOD(LOC,0)
RETURN
END
SUBROUTINE PROD(HITS,Z6,LIMIT,CRAHIT,CRALOC,
&LOPMAX,AR2S,J,RANGE)
IMPLICIT INTEGER(A-Z)
DIMENSION RANGE(501:700),AR2S(1501:2000)
COMMON/MODE/MODE,KURSOR,JECTOR,ISEC
COMMON /CODE/CODE(1501:3000)
COMMON/IARROW/IARROW(0:9)
D TYPE 101,CRALOC,LOPMAX
D 101 FORMAT(' CRALOC,LOPMAX:',2G)
DO 100 I=CRALOC+1,LOPMAX+CRALOC
IF(S(I)#0) GOTO 100
IF(I>LIMIT+CRALOC) LIMIT=I-CRALOC
CALL CHAS(I,Z6)
IF(HITS>1) CALL CHITS(CRAHIT+I-CRALOC,HITS)
IF(J>1) CALL CMYCOD(I,0)
IF(J<2) CODE(I)=0
IF(J==1) AR2S(I)=0
IF(CRALOC==2000) RANGE(I-1500)=20
IF(J==3) RANGE(I)=20
GOTO(1,2,3,4,5,6,7,8,9) J
1 RETURN
2 CALL STROUT('N ARMY',51)
RETURN
3 CALL STROUT(' FIGHTER',51)
RETURN
4 CALL STROUT(' DESTROYER',51)
RETURN
5 CALL STROUT(' SUBMARINE',51)
RETURN
6 CALL STROUT(' TROOP TRANSPORT',51)
RETURN
7 CALL STROUT(' CRUISER',51)
RETURN
8 CALL STROUT(' AIRCRAFT CARRIER',51)
RETURN
9 CALL STROUT(' BATTLESHIP',51)
RETURN
100 CONTINUE
200 RETURN
END
SUBROUTINE FIGHTR
INCLUDE 'COMMON.EMP/NOLIST'
C IFO=7: CITY LOCATION
C IFO=6: CARRIER #
C IFO=5: TARGET LOCATION
C IFO=4: TARGET LOCATION, KAMIKAZE MISSION
C IFO=3: DIRECTIONAL
C IFO=2: DIRECTIONAL, KAMIKAZE MISSION
MONKEY=0
NUMBER(2)=0
IF(CODER==2.) TYPE 100
100 FORMAT(' FIGHTER CODES')
DO 1000 Y=1,LIMIT(10)
DO 1001 I1=1,Z3
Z6=S(2000+Y)
IF(Z6==0) GOTO 1000
DIR MONKEY=Y
P=0.
Z7=Z6
AB=A(1,Z6)
DO 2000 IA=1,6
DO 2000 IB=1,5
2000 IF(TROOPT(IA,IB)==Z6) TROOPT(IA,IB)=0
IF((AB#'2').AND.(AB#'X').AND.(AB#'7')) GOTO 500
IF((AB=='X').OR.(AB=='7')) RANG(Y)=Z3*5
IF(RANG(Y)#0) GOTO 499
CALL CHANGE(Z6,D1(Z6),1)
GOTO 500
C MOVE SELECTION
499 IF(ILATT(CODE(Y+500))==Z6) GOTO 201
IFO=IFORM(CODE(Y+500))
ILA=ILATT(CODE(Y+500))
* DOES A NEW CODE NEED TO BE SELECTED? 201:YES, 300:NO
GOTO (201,2,3,4,5,6,7) IFO
GOTO 201
2 IF(RAN(C1)<.05) ILA=ICORR(ILA+1)
IF(RANG(Y)>=10) GOTO 300
DO 21 I=1,70
21 IF((X(I)#0).AND.(IDIST(Z6,X(I))<=RANG(Y))) GOTO 22
GOTO 300
22 IFO=7
ILA=X(I)
GOTO 300
3 IF(RAN(C1)<.1) ILA=ICORR(ILA+1)
IF(RANG(Y)<=11) 201,300
4 IF(ILA==Z6) 201, 300
5 IF((ILA==Z6).OR.(RANG(Y)<=11)) 201, 300
6 IF(Z6==S(ILA+2800)) GOTO 201 !IF LANDED
IF(S(ILA+2800)==0) GOTO 201 !IF CARRIER DOESN'T EXIST
IF(IDIST(Z6,S(ILA+2800))>RANG(Y)) 201, 300 !IF OUT OF RANG
7 IF(Z6==ILA) GOTO 201 !IF LANDED
IF(IDIST(Z6,ILA)>RANG(Y)) 201, 300 !IF OUT OF RANG
* NEW CODE SELECTION
201 ID=0
IF(AB=='2') GOTO 253 !IF FIGHTER IS AIRBORNE
ID=0
GOTO 700 !FIRST OF ALL, LOOK FOR TROOP TRANSPORTS & SUBS
702 FUEL=RANG(Y) !NO CHOICE BUT BE KAMIKAZE
GOTO 703 !START LOOKING FOR ENEMY TROOP TRANS.
700 FUEL=RANG(Y)/2 !DO THIS SO CRAFT CAN RETURN TO REFUEL
IF(RAN(C1)<.05) FUEL=RANG(Y) !1 IN 20 IS KAMIKAZE
703 ISHIPT=3 !ENEMY TROOP TRANSPORTS
*.................................
* LOOK FOR ENEMY TROOP TRANSPORTS, THEN SUBMARINES
706 DO 704 I=1,5
IF(TROOPT(ISHIPT,I)==0) GOTO 704
IF(IDIST(Z6,TROOPT(ISHIPT,I))>FUEL) GOTO 704 !OUT OF RANG
IFO=5
IF(FUEL==RANG(Y)) IFO=4
ILA=TROOPT(ISHIPT,I)
GOTO 300 !PROCEED TO MOVE CORRECTION
704 CONTINUE
IF(ISHIPT==2) GOTO 900 !IF ALREADY LOOKED FOR SUBS
ISHIPT=2; GOTO 706 !NOW LOOK FOR SUBS
900 IF(ID==1000) GOTO 707 !IF NO REFUELING SPOT WITHIN RANG
IF(RAN(C1)<.33) GOTO 707 !LOOK FOR ENEMY CONCENTRATIONS
IF(RAN(C1)<.5) GOTO 253 !MOVE TOWARDS CITY OR CARRIER
*.....................................
* MOVE IN A RANDOM DIRECTION
701 IFO=3
DIR=ICORR(DIR+1)
ILA=DIR
IF(RAN(C1)<.1) IFO=2 !ONE OUT OF 20 WILL BE KAMIKAZE
IF(NUM2<=2) IFO=3
GOTO 300 !PROCEED TO MOVE CORRECTION
*.........................................
* MOVE TOWARD AN ENEMY CONCENTRATION WITHIN RANG
707 DO 705 I=1,10
DO 705 J=2,11
IF(LOCI(I,J)==0) GOTO 705
IF(IDIST(Z6,LOCI(I,J))>FUEL) GOTO 705 !IF OUT OF RANG
IFO=5
IF(FUEL==RANG(Y)) IFO=4 !KAMIKAZE
ILA=LOCI(I,J)
GOTO 300 !PROCEED TO MOVE CORRECTION
705 CONTINUE
IF(ID==1000) GOTO 701 !IF NO CITY OR CARRIER IS WITHIN RANG
*..................................
* NOW MOVE TOWARDS A CITY CLOSEST TO ENEMY CONCENTRATION
253 IA=MOD(Y,10)+1
DO 254 IB=IA,IA+9
I=IB
IF(I>10) I=I-10
IF(LOCI(I,2)==0) GOTO 254
LOC=LOCI(I,2)
ID=IDIST(Z6,LOCI(I,2))
GOTO 800
254 CONTINUE
LOC=EXPL(DUMMY)
800 ID=1000
IGARBG=INT(RAN(C1)*FLOAT(70+LIMIT(15))+1.)
DO 255 ILOOP=IGARBG,IGARBG+70+LIMIT(15)
IA=ILOOP
IF(IA>70+LIMIT(15)) IA=IA-70-LIMIT(15)
IF(IA>70) GOTO 256
IF((OWNER(IA)#2).OR.(IDIST(Z6,X(IA))>RANG(Y))) GOTO 255
IF(IDIST(X(IA),LOC)>=ID) GOTO 255
IFO=7
ILA=X(IA)
ID=IDIST(X(IA),LOC)
GOTO 255
256 IB=IA-70
IF(S(2800+IB)==0) GOTO 255
IF(IDIST(Z6,S(2800+IB))>RANG(Y)) GOTO 255
IF(IDIST(S(2800+IB),LOC)>=ID) GOTO 255
IF((RANG(Y)==20).AND.(IDIST(Z6,S(2800+IB))>12)
&.AND.(MOD(IFORM(CODE(1300+IB)),10)#9)) GOTO 255
IFO=6
ILA=IB
ID=IDIST(S(2800+IB),LOC)
255 CONTINUE
IF(ID==1000) GOTO 702
GOTO 300
*..................................
* MOVE CORRECTION
300 IZOT=0
MOOV=0
IF(ILA>100) IZOT=MOV(Z6,ILA)
IF(ILA<10) IZOT=ILA
IF(IFO==6) IZOT=MOV(Z6,S(2800+ILA))
IF((IFO<4).AND.(RAN(C1)<.05)) IZOT=ICORR(IZOT+1)
DO 301 I=1,8
AC=A(1,Z6+IARROW(I))
IF((AC#'D').AND.(AC#'S').AND.(AC#'T')
&.AND.(AC#'F').AND.(AC#'A')) GOTO 301
MOOV=I
GOTO 400
301 CONTINUE
** LOOK FOR TERRITORY TO EXPLOR IN FRONT
IF (RANG(Y)<=10) GOTO 303 !IF LOW ON FUEL
IZOT2=IZOT !STORE IZOT A MOMENT
Z62=Z6+IARROW(ICORR(IZOT2+1))
IF(ORDER(Z62)#0) GOTO 304 !IF ON THE EDGE OF THE MAP
IF(A(0,Z62)==' ') IZOT=ICORR(IZOT2+1) !IF Z62 IS UNEXPLORED
304 Z62=Z6+IARROW(ICORR(IZOT2-1)) !TRY OTHER SIDE
IF(ORDER(Z62)#0) GOTO 303 !IF ON THE EDGE OF THE MAP
IF(A(0,Z62)==' ') IZOT=ICORR(IZOT2-1) !IF Z62 IS UNEXPLORED
303 DESTIN=ILA
IF(IFO==6) DESTIN=S(2800+ILA)
ID=IZOT
DO 302 I=0,7
IZOT=ICORR(ID+I)
NEWLOC=Z6+IARROW(IZOT)
IF((IFO>3).AND.(IDIST(Z6,DESTIN)<=IDIST(NEWLOC,DESTIN)))
& GOTO 302
AC=A(1,NEWLOC)
IF((((AC>='A').AND.(AC<='T')).OR.(AC=='X').OR.(AC=='.').OR.
&(AC=='7').OR.(AC=='+')).AND.(ORDER(NEWLOC)==0))GOTO400
302 CONTINUE
IZOT=0
400 CODE(500+Y)=10000*IFO+ILA
IF(IFO<4) CODE(500+Y)=10000*IFO+IZOT
IB=CODE(500+Y)
IF(CODER==2.) TYPE 101,IB
101 FORMAT(G)
IF(MOOV#0) IZOT=MOOV
Z6=Z6+IARROW(IZOT)
C MOVE EVALUATION
IF(AB=='2') CALL CHANGE(Z7,D1(Z7),1)
AB=A(1,Z6)
IF((AB=='.').OR.(AB=='+')) GOTO 600
IF((AB=='X').OR.(AB=='7')) GOTO 601
IF(D1(Z6)=='*') GOTO 500
H2=30
P=1.
H1=1
OWN1='2'
OWN2=AB
CALL FIND(OWN2,Z6,Z8,H2)
CALL FGHT(Z6,H1,H2,OWN1,OWN2)
CALL FIND(OWN2,Z6,Z8,H2)
IF(H1<=0) GOTO 500
600 CALL CHANGE(Z6,'2',1)
601 RANG(Y)=RANG(Y)-1
IF(I1==1) NUMBER(2)=NUMBER(2)+1
CALL CHAS(2000+Y,Z6)
CALL SONAR(Z6)
IF(P==1.) CALL SENSOR(Z6)
GOTO 1001
500 CALL CHAS(2000+Y,0)
CALL SONAR(Z6)
IF(P==1.) CALL SENSOR(Z6)
GOTO 1000
1001 CONTINUE
1000 CONTINUE
RETURN
END
SUBROUTINE ARMCNT(ARMTOT,CODE,TARGET,LIMIT)
INTEGER ARMTOT(20),CODE(1500),TARGET(70),LIMIT(13)
DO 200 I=1,20
200 ARMTOT(I)=0
DO 100 I=1,LIMIT(9)
IF((CODE(I)<10000).OR.(CODE(I)>19999)) GOTO 100
ILA=ILATT(CODE(I))
DO 150 I2=1,20
150 IF(TARGET(I2)==ILA) ARMTOT(I2)=ARMTOT(I2)+1
100 CONTINUE
RETURN
END
.