forked from DigitalMars/Empire-for-PDP-10
-
Notifications
You must be signed in to change notification settings - Fork 0
/
8.FOR
142 lines (120 loc) · 3.89 KB
/
8.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
C SUBROUTINE 8
SUBROUTINE CITYPH
INCLUDE 'COMMON.EMP/NOLIST'
DIMENSION PH(8),OVRPOP(0:15,2),OK(5)
DATA PH/1,2,4,5,6,10,12,15/
DATA OK/'+',' ','*','X','O'/
DATA OVRPOP/
& 9,001,002,9,003,004,05,9,9,9,06,9,07,9,9,08,
& 0,499,199,0,199,199,83,0,0,0,99,0,99,0,0,99/
C NUMBER(1-8): #'S OF UNITS
C NUMBER(11-18): #'S OF CITIES WITH EACH PHASE
C NUMBER(9): # OF CITIES
C NUMBER(10): # OF TARGET CITIES
DO 100 I=1,70
IF(OWNER(I)#2) GOTO 100
IF((PHASE(I)>0).AND.(FOUND(I)#MDATE+5*PHASE(I)-1)) GOTO 100
INT=PHASE(I)
IF(PHASE(I)#-1) GOTO 102
PHASE(I)=1
GOTO 400
102 EDGE=INT(EDGER(X(I)))
* IF WE HAVE JUST MADE A FIGHTER, AND HAVE ONE CITY, MAKE SOMETHING ELSE
IF((NUMBER(9)==1).AND.(PHASE(I)==2)) PHASE(I)=0
* IF WE HAVE A PHASE OF 0, MAKE SOMETHING!
IF(PHASE(I)==0) GOTO 300
* IF CITY IS SURROUNDED BY ARMIES, MAKE SOMETHING ELSE
CROWD=.FALSE.
IF(PHASE(I)#1) GOTO 701
DO 702 J=1,8
702 IF(A(1,X(I)+IARROW(J))=='+') GOTO 701
CROWD=.TRUE.
GOTO 300
* IF CRAFT NUMBERS ARE GETTING GROSSLY LARGE, PRODUCE SOMETHING ELSE
701 IF(NUMBER(OVRPOP(PHASE(I),1))>OVRPOP(PHASE(I),2)) GOTO 300
IF(EDGE#8) GOTO 101
IF((NUMBER(9)>1).AND.(PHASE(I)==1)) GOTO 600
IF(NUMBER(9)>1) GOTO 100
IF(NUMBER(5)<1) PHASE(I)=6
IF(NUMBER(5)>0) PHASE(I)=1
GOTO 100
101 IF(PHASE(I)#1) GOTO 100
N=0
DO 503 J=IAR2+1,IAR2+LIMIT(9)
Z=S(J)
IF((Z==0).OR.(IDIST(X(I),Z)>6)) GOTO 503
IF(A(0,Z)=='5') GOTO 503
MOVE=PATH(X(I),Z,1,OK,FLAG)
IF(FLAG==0) GOTO 503
N=N+1
503 CONTINUE
IF((N>5).AND.(NUMBER(11)>1)) GOTO 300
GOTO 100
* SELECT A NEW PHASE FOR THE CITY
300 CONTINUE
* IF THERE ARE ENEMY ARMIES ON THE CONTINENT, PRODUCE ARMIES!
IF(EDGE==8) GOTO 600
DO 500 J=1,10
IF(LOCI(J,2)==0) GOTO 500
MOVE=PATH(X(I),LOCI(J,2),1,OK,FLAG)
IF(FLAG==0) GOTO 500
PHASE(I)=1
GOTO 400
500 CONTINUE
504 PHASE(I)=2
IF(EDGE>0) GOTO 501 !IF NOT LANDLOCKED
IF(NUMBER(1)<=3*NUMBER(2)) PHASE(I)=1 !IF SMALL # OF ARMIES
GOTO 400
501 PHASE(I)=1
N=0
DO 502 J=IAR2+1,IAR2+LIMIT(9)
Z=S(J)
IF((Z==0).OR.(IDIST(X(I),Z)>6)) GOTO 502
IF(A(0,Z)=='5') GOTO 502 !IF ON TROOP TRANSPORT
MOVE=PATH(X(I),Z,1,OK,FLAG)
IF(FLAG==0) GOTO 502
N=N+1
502 CONTINUE
IF(N<3) GOTO 400
PHASE(I)=2
IF(NUMBER(2)<NUMBER(9)/2) GOTO 400
GOTO 600
* SELECT A SHIP, GUARANTEING AT LEAST TWO CITIES PRODUCING TROOP TRANSPORTS
600 PHASE(I)=PH(8)
DO 601 J=8,4,-1
601 IF(NUMBER(J+10)>=NUMBER(J+9)) PHASE(I)=PH(J-1)
IF(NUMBER(17)==0) PHASE(I)=12
IF(NUMBER(15)<2) PHASE(I)=6
GOTO 400
400 IF((NUMBER(9)>1).AND.(NUMBER(15)==0).AND.(EDGE>0)) PHASE(I)=6
IF(INT==PHASE(I)) GOTO 100
FOUND(I)=6*PHASE(I)+MDATE
CALL CITYCT(OWNER,NUMBER,PHASE)
IF(CODER<9.) GOTO 100
CALL CURSOR(100,KURSOR)
TYPE 131,X(I),INT,PHASE(I),EDGE
131 FORMAT('+CITY:',I4,' FROM:',I2,' TO:',I2,' EDGE:',I1,3X$)
100 CONTINUE
RETURN
END
* THIS HAS BEEN REWRITTEN IN MACRO (EXACT EQUIVALENT)
C FUNCTION MOV(I6,I7)
C IY6=(I6-1)/100
C IY7=(I7-1)/100
C IX6=I6-100*IY6
C IX7=I7-100*IY7
C IY=IY7-IY6
C IX=IX7-IX6
C IF((IY<0).AND.(IX>0)) MOV=2
C IF((IY<0).AND.(IX==0)) MOV=3
C IF((IY<0).AND.(IX<0)) MOV=4
C IF((IY==0).AND.(IX<0)) MOV=5
C IF((IY>0).AND.(IX<0)) MOV=6
C IF((IY>0).AND.(IX==0)) MOV=7
C IF((IY>0).AND.(IX>0)) MOV=8
C IF((IY==0).AND.(IX>0)) MOV=1
C IF((IX==0).AND.(IY==0)) MOV=0
C RETURN
C RETURN
C END
.