home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
SIMTEL
/
CPMUG
/
CPMUG021.ARK
/
WARI.ASC
< prev
next >
Wrap
Text File
|
1984-04-29
|
3KB
|
91 lines
100 PRINT CHR$(26) : WIDTH 120
101 U=1:J=U:X=6:Z=0:Q=14:P=13:H=100:D=12:W9=.25:G=4:T4=24:T2=2
102 DIM T(Q),Y(Q),W(Q),V(X),E(X),B(Q)
103 INPUT"GIVE ME A RANDOM NUMBER";M
104 R1=RND(-M)
105 PRINT"********** WARI - A GAME OF SKILL **************"
106 FOR J=U TO Q:B(J)=G:NEXT J
107 B(P)=Z:B(Q)=Z:M1=Z
108 R1=RND(U):R1=R1/D:W1=W9+R1:W2=W9-R1
109 INPUT"DO YOU WISH TO GO FIRST (Y OR N)";A$
110 IF A$="N" THEN 121
111 IF A$<>"Y" THEN 109
112 GOSUB 179
113 INPUT"YOUR MOVE";M:IF M>X THEN 113
114 FOR J=U TO Q:T(J)=B(J):NEXT J:GOSUB 128
115 IF M<Z THEN PRINT"ILLEGAL MOVE":GOTO 113
116 FOR J=U TO Q:B(J)=T(J):NEXT J
117 M1=M1+U:IF M1<X THEN GOSUB 179
118 IF B(P)<T4 THEN 121
119 GOSUB 179
120 PRINT"I MUST BOW TO YOUR SUPERIOR INTELLIGENCE--YOU WIN!":GOTO105
121 GOSUB 154
122 PRINT:PRINT"MY MOVE IS";M
123 FOR J=U TO Q:T(J)=B(J):NEXT J:GOSUB 128
124 FOR J=U TO Q:B(J)=T(J):NEXT J
125 IF B(Q)<T4 THEN 112
126 GOSUB 179
127 PRINT:PRINT:PRINT"HA HA I WIN!!!!":PRINT:PRINT:GOTO105
128 IF M<U THEN 131
129 IF M>D THEN 131
130 IF M=INT(M) THEN 132
131 M=-U:RETURN
132 IF T(M)=Z THEN M=-T2:RETURN
133 I=Z:IF M>X THEN I=U:GOTO 135
134 FOR J=U TO Q:Y(J)=T(J):NEXT J:GOTO 137
135 FOR J=U TO X:Y(J)=T(J+X):Y(J+X)=T(J):NEXT J
136 Y(P)=T(Q):Y(Q)=T(P):M=M-X
137 N=Y(M):C=M
138 FOR J=U TO N:C=C+U
139 IF C=P THEN C=U
140 IF C=M THEN C=C+U
141 IF C=P THEN C=U
142 Y(C)=Y(C)+U:NEXT J
143 Y(M)=Z:L=C
144 IF L<U+X THEN 148
145 IFY(L)>=G THEN 148
146 IF Y(L)<T2 THEN 148
147 Y(P)=Y(P)+Y(L):Y(L)=Z:L=L-U:GOTO 144
148 S=Z:FOR J=U+X TO D:S=S+Y(J):NEXT J
149 IF S=Z THEN M=-T2-U:RETURN
150 IF I=Z THEN FOR J=UTOQ:T(J)=Y(J):NEXT J:GOTO153
151 FORJ=U TO X:T(J)=Y(J+X):T(J+X)=Y(J):NEXT J
152 T(Q)=Y(P):T(P)=Y(Q)
153 RETURN
154 FOR A=U TO X
155 M=A+X:IF B(M)=Z THEN E(A)=-H:GOTO175
156 FOR J=U TO Q:T(J)=B(J):NEXT J :GOSUB 128
157 IFM<Z THEN E(A)=-H:GOTO175
158 IFT(Q)>=T4 THEN M=A+X:RETURN
159 FOR J=U TO Q: W(J)=T(J):NEXT J
160 FOR R=U TO X:IF T(R)=Z THEN V(R)=H:GOTO172
161 FOR J=U TO Q:T(J)=W(J):NEXT J
162 M=R: GOSUB128
163 IF M<Z THEN V(R)=H:GOTO 172
164 F1=Z:F2=Z:F3=Z:F4=Z:F5=Z
165 FOR J=U+X TO D:F2=F2+T(J)
166 IF T(J)>Z THEN F1=F1+U
167 IF T(J)<=T2 THEN F3=F3+U
168 IF T(J)>F4 THEN F4=T(J)
169 NEXT J:F5=F2:FOR J=U TO X:F5=F5+T(J):NEXT J
170 F1=F1/X:F4=U-(F4/F2):F3=U-(F3/X):F2=F2/F5
171 V(R)=(W1*(F1+F2))+(W2*(F3+F4))+(T(Q)-B(Q))-(T(P)-B(P))
172 NEXT R:E(A)=H
173 FOR J=U TO X:IF V(J)<E(A) THEN E(A)=V(J)
174 NEXT J
175 NEXT A
176 M=Z:A=-H:FOR J=U TO X
177 IF E(J)>A THEN A=E(J):M=X+J
178 NEXT J:RETURN
179 PRINT
180 PRINT"10";TAB(25);B(P-3);SPC(5);B(P-4);SPC(26);"9"
181 PRINT"11";TAB(18);B(P-2);SPC(19);B(P-5);SPC(19);"8"
182 PRINT"12";TAB(11);B(P-1);SPC(33);B(P-6);SPC(12);"7"
183 PRINT
184 PRINT"1";TAB(11);B(1);SPC(33);B(6);SPC(12);"6"
185 PRINT"2";TAB(18);B(2);SPC(19);B(5);SPC(19);"5"
186 PRINT"3";TAB(25);B(3);SPC(5);B(4);SPC(26);"4"
187 PRINT:PRINT"I HAVE NOW CAPTURED ";B(Q);"MEN"
188 PRINT"AND YOU HAVE CAPTURED ";B(P);"MEN":PRINT
189 RETURN