comp.c revision 1.14 1 1.14 mrg /* $NetBSD: comp.c,v 1.14 2019/02/04 03:29:41 mrg Exp $ */
2 1.4 cgd
3 1.1 cgd /*
4 1.3 jtc * Copyright (c) 1982, 1993
5 1.3 jtc * The Regents of the University of California. All rights reserved.
6 1.1 cgd *
7 1.1 cgd * Redistribution and use in source and binary forms, with or without
8 1.1 cgd * modification, are permitted provided that the following conditions
9 1.1 cgd * are met:
10 1.1 cgd * 1. Redistributions of source code must retain the above copyright
11 1.1 cgd * notice, this list of conditions and the following disclaimer.
12 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 cgd * notice, this list of conditions and the following disclaimer in the
14 1.1 cgd * documentation and/or other materials provided with the distribution.
15 1.9 agc * 3. Neither the name of the University nor the names of its contributors
16 1.1 cgd * may be used to endorse or promote products derived from this software
17 1.1 cgd * without specific prior written permission.
18 1.1 cgd *
19 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 1.1 cgd * SUCH DAMAGE.
30 1.1 cgd */
31 1.1 cgd
32 1.5 lukem #include <sys/cdefs.h>
33 1.1 cgd #ifndef lint
34 1.4 cgd #if 0
35 1.4 cgd static char sccsid[] = "@(#)comp.c 8.1 (Berkeley) 5/31/93";
36 1.4 cgd #else
37 1.14 mrg __RCSID("$NetBSD: comp.c,v 1.14 2019/02/04 03:29:41 mrg Exp $");
38 1.4 cgd #endif
39 1.1 cgd #endif /* not lint */
40 1.1 cgd
41 1.12 dholland #include "mille.h"
42 1.1 cgd
43 1.1 cgd /*
44 1.1 cgd * @(#)comp.c 1.1 (Berkeley) 4/1/82
45 1.1 cgd */
46 1.1 cgd
47 1.12 dholland #define V_VALUABLE 40
48 1.1 cgd
49 1.5 lukem void
50 1.11 dholland calcmove(void)
51 1.1 cgd {
52 1.5 lukem CARD card;
53 1.5 lukem int *value;
54 1.5 lukem PLAY *pp, *op;
55 1.14 mrg bool foundend, canstop, foundlow;
56 1.14 mrg int cango;
57 1.13 dholland unsigned int i, count200, badcount, nummin, nummax, diff;
58 1.5 lukem int curmin, curmax;
59 1.5 lukem CARD safe, oppos;
60 1.5 lukem int valbuf[HAND_SZ], count[NUM_CARDS];
61 1.5 lukem bool playit[HAND_SZ];
62 1.1 cgd
63 1.1 cgd wmove(Score, ERR_Y, ERR_X); /* get rid of error messages */
64 1.1 cgd wclrtoeol(Score);
65 1.1 cgd pp = &Player[COMP];
66 1.1 cgd op = &Player[PLAYER];
67 1.1 cgd safe = 0;
68 1.1 cgd cango = 0;
69 1.1 cgd canstop = FALSE;
70 1.1 cgd foundend = FALSE;
71 1.3 jtc
72 1.3 jtc /* Try for a Coup Forre, and see what we have. */
73 1.1 cgd for (i = 0; i < NUM_CARDS; i++)
74 1.1 cgd count[i] = 0;
75 1.1 cgd for (i = 0; i < HAND_SZ; i++) {
76 1.1 cgd card = pp->hand[i];
77 1.1 cgd switch (card) {
78 1.1 cgd case C_STOP: case C_CRASH:
79 1.1 cgd case C_FLAT: case C_EMPTY:
80 1.5 lukem if ((playit[i] = canplay(pp, op, card)) != 0)
81 1.1 cgd canstop = TRUE;
82 1.1 cgd goto norm;
83 1.1 cgd case C_LIMIT:
84 1.1 cgd if ((playit[i] = canplay(pp, op, card))
85 1.1 cgd && Numseen[C_25] == Numcards[C_25]
86 1.1 cgd && Numseen[C_50] == Numcards[C_50])
87 1.1 cgd canstop = TRUE;
88 1.1 cgd goto norm;
89 1.1 cgd case C_25: case C_50: case C_75:
90 1.1 cgd case C_100: case C_200:
91 1.1 cgd if ((playit[i] = canplay(pp, op, card))
92 1.1 cgd && pp->mileage + Value[card] == End)
93 1.1 cgd foundend = TRUE;
94 1.1 cgd goto norm;
95 1.1 cgd default:
96 1.1 cgd playit[i] = canplay(pp, op, card);
97 1.1 cgd norm:
98 1.1 cgd if (playit[i])
99 1.1 cgd ++cango;
100 1.1 cgd break;
101 1.1 cgd case C_GAS_SAFE: case C_DRIVE_SAFE:
102 1.1 cgd case C_SPARE_SAFE: case C_RIGHT_WAY:
103 1.1 cgd if (pp->battle == opposite(card) ||
104 1.1 cgd (pp->speed == C_LIMIT && card == C_RIGHT_WAY)) {
105 1.1 cgd Movetype = M_PLAY;
106 1.1 cgd Card_no = i;
107 1.1 cgd return;
108 1.1 cgd }
109 1.1 cgd ++safe;
110 1.1 cgd playit[i] = TRUE;
111 1.1 cgd break;
112 1.1 cgd }
113 1.3 jtc if (card >= 0)
114 1.3 jtc ++count[card];
115 1.1 cgd }
116 1.3 jtc
117 1.3 jtc /* No Coup Forre. Draw to fill hand, then restart, as needed. */
118 1.1 cgd if (pp->hand[0] == C_INIT && Topcard > Deck) {
119 1.1 cgd Movetype = M_DRAW;
120 1.1 cgd return;
121 1.1 cgd }
122 1.3 jtc
123 1.1 cgd #ifdef DEBUG
124 1.1 cgd if (Debug)
125 1.1 cgd fprintf(outf, "CALCMOVE: cango = %d, canstop = %d, safe = %d\n",
126 1.1 cgd cango, canstop, safe);
127 1.1 cgd #endif
128 1.1 cgd if (foundend)
129 1.1 cgd foundend = !check_ext(TRUE);
130 1.1 cgd for (i = 0; safe && i < HAND_SZ; i++) {
131 1.8 jsm if (is_safety(pp->hand[i])) {
132 1.1 cgd if (onecard(op) || (foundend && cango && !canstop)) {
133 1.1 cgd #ifdef DEBUG
134 1.1 cgd if (Debug)
135 1.1 cgd fprintf(outf,
136 1.1 cgd "CALCMOVE: onecard(op) = %d, foundend = %d\n",
137 1.1 cgd onecard(op), foundend);
138 1.1 cgd #endif
139 1.1 cgd playsafe:
140 1.1 cgd Movetype = M_PLAY;
141 1.1 cgd Card_no = i;
142 1.1 cgd return;
143 1.1 cgd }
144 1.1 cgd oppos = opposite(pp->hand[i]);
145 1.1 cgd if (Numseen[oppos] == Numcards[oppos] &&
146 1.1 cgd !(pp->hand[i] == C_RIGHT_WAY &&
147 1.1 cgd Numseen[C_LIMIT] != Numcards[C_LIMIT]))
148 1.1 cgd goto playsafe;
149 1.1 cgd else if (!cango
150 1.1 cgd && (op->can_go || !pp->can_go || Topcard < Deck)) {
151 1.1 cgd card = (Topcard - Deck) - roll(1, 10);
152 1.1 cgd if ((!pp->mileage) != (!op->mileage))
153 1.1 cgd card -= 7;
154 1.1 cgd #ifdef DEBUG
155 1.1 cgd if (Debug)
156 1.1 cgd fprintf(outf,
157 1.1 cgd "CALCMOVE: card = %d, DECK_SZ / 4 = %d\n",
158 1.1 cgd card, DECK_SZ / 4);
159 1.1 cgd #endif
160 1.1 cgd if (card < DECK_SZ / 4)
161 1.1 cgd goto playsafe;
162 1.1 cgd }
163 1.1 cgd safe--;
164 1.1 cgd playit[i] = cango;
165 1.1 cgd }
166 1.1 cgd }
167 1.8 jsm if (!pp->can_go && !is_repair(pp->battle))
168 1.1 cgd Numneed[opposite(pp->battle)]++;
169 1.1 cgd redoit:
170 1.1 cgd foundlow = (cango || count[C_END_LIMIT] != 0
171 1.1 cgd || Numseen[C_LIMIT] == Numcards[C_LIMIT]
172 1.1 cgd || pp->safety[S_RIGHT_WAY] != S_UNKNOWN);
173 1.1 cgd foundend = FALSE;
174 1.1 cgd count200 = pp->nummiles[C_200];
175 1.1 cgd badcount = 0;
176 1.1 cgd curmax = -1;
177 1.1 cgd curmin = 101;
178 1.1 cgd nummin = -1;
179 1.1 cgd nummax = -1;
180 1.1 cgd value = valbuf;
181 1.1 cgd for (i = 0; i < HAND_SZ; i++) {
182 1.1 cgd card = pp->hand[i];
183 1.8 jsm if (is_safety(card) || playit[i] == (cango != 0)) {
184 1.1 cgd #ifdef DEBUG
185 1.1 cgd if (Debug)
186 1.1 cgd fprintf(outf, "CALCMOVE: switch(\"%s\")\n",
187 1.1 cgd C_name[card]);
188 1.1 cgd #endif
189 1.1 cgd switch (card) {
190 1.1 cgd case C_25: case C_50:
191 1.1 cgd diff = End - pp->mileage;
192 1.1 cgd /* avoid getting too close */
193 1.1 cgd if (Topcard > Deck && cango && diff <= 100
194 1.7 jsm && (int)diff / Value[card] > count[card]
195 1.1 cgd && (card == C_25 || diff % 50 == 0)) {
196 1.1 cgd if (card == C_50 && diff - 50 == 25
197 1.1 cgd && count[C_25] > 0)
198 1.1 cgd goto okay;
199 1.1 cgd *value = 0;
200 1.1 cgd if (--cango <= 0)
201 1.1 cgd goto redoit;
202 1.1 cgd break;
203 1.1 cgd }
204 1.1 cgd okay:
205 1.1 cgd *value = (Value[card] >> 3);
206 1.1 cgd if (pp->speed == C_LIMIT)
207 1.1 cgd ++*value;
208 1.1 cgd else
209 1.1 cgd --*value;
210 1.1 cgd if (!foundlow
211 1.1 cgd && (card == C_50 || count[C_50] == 0)) {
212 1.1 cgd *value = (pp->mileage ? 10 : 20);
213 1.1 cgd foundlow = TRUE;
214 1.1 cgd }
215 1.1 cgd goto miles;
216 1.1 cgd case C_200:
217 1.1 cgd if (++count200 > 2) {
218 1.1 cgd *value = 0;
219 1.1 cgd break;
220 1.1 cgd }
221 1.14 mrg /* FALLTHROUGH */
222 1.1 cgd case C_75: case C_100:
223 1.1 cgd *value = (Value[card] >> 3);
224 1.1 cgd if (pp->speed == C_LIMIT)
225 1.1 cgd --*value;
226 1.1 cgd else
227 1.1 cgd ++*value;
228 1.1 cgd miles:
229 1.1 cgd if (pp->mileage + Value[card] > End)
230 1.1 cgd *value = (End == 700 ? card : 0);
231 1.1 cgd else if (pp->mileage + Value[card] == End) {
232 1.1 cgd *value = (foundend ? card : V_VALUABLE);
233 1.1 cgd foundend = TRUE;
234 1.1 cgd }
235 1.1 cgd break;
236 1.1 cgd case C_END_LIMIT:
237 1.1 cgd if (pp->safety[S_RIGHT_WAY] != S_UNKNOWN)
238 1.1 cgd *value = (pp->safety[S_RIGHT_WAY] ==
239 1.1 cgd S_PLAYED ? -1 : 1);
240 1.1 cgd else if (pp->speed == C_LIMIT &&
241 1.1 cgd End - pp->mileage <= 50)
242 1.1 cgd *value = 1;
243 1.1 cgd else if (pp->speed == C_LIMIT
244 1.1 cgd || Numseen[C_LIMIT] != Numcards[C_LIMIT]) {
245 1.1 cgd safe = S_RIGHT_WAY;
246 1.1 cgd oppos = C_LIMIT;
247 1.1 cgd goto repair;
248 1.1 cgd }
249 1.1 cgd else {
250 1.1 cgd *value = 0;
251 1.1 cgd --count[C_END_LIMIT];
252 1.1 cgd }
253 1.1 cgd break;
254 1.1 cgd case C_REPAIRS: case C_SPARE: case C_GAS:
255 1.1 cgd safe = safety(card) - S_CONV;
256 1.1 cgd oppos = opposite(card);
257 1.1 cgd if (pp->safety[safe] != S_UNKNOWN)
258 1.1 cgd *value = (pp->safety[safe] ==
259 1.1 cgd S_PLAYED ? -1 : 1);
260 1.1 cgd else if (pp->battle != oppos
261 1.1 cgd && (Numseen[oppos] == Numcards[oppos] ||
262 1.1 cgd Numseen[oppos] + count[card] >
263 1.1 cgd Numcards[oppos])) {
264 1.1 cgd *value = 0;
265 1.1 cgd --count[card];
266 1.1 cgd }
267 1.1 cgd else {
268 1.1 cgd repair:
269 1.1 cgd *value = Numcards[oppos] * 6;
270 1.1 cgd *value += Numseen[card] -
271 1.1 cgd Numseen[oppos];
272 1.1 cgd if (!cango)
273 1.1 cgd *value /= (count[card]*count[card]);
274 1.1 cgd count[card]--;
275 1.1 cgd }
276 1.1 cgd break;
277 1.1 cgd case C_GO:
278 1.1 cgd if (pp->safety[S_RIGHT_WAY] != S_UNKNOWN)
279 1.1 cgd *value = (pp->safety[S_RIGHT_WAY] ==
280 1.1 cgd S_PLAYED ? -1 : 2);
281 1.1 cgd else if (pp->can_go
282 1.1 cgd && Numgos + count[C_GO] == Numneed[C_GO]) {
283 1.1 cgd *value = 0;
284 1.1 cgd --count[C_GO];
285 1.1 cgd }
286 1.1 cgd else {
287 1.1 cgd *value = Numneed[C_GO] * 3;
288 1.1 cgd *value += (Numseen[C_GO] - Numgos);
289 1.1 cgd *value /= (count[C_GO] * count[C_GO]);
290 1.1 cgd count[C_GO]--;
291 1.1 cgd }
292 1.1 cgd break;
293 1.1 cgd case C_LIMIT:
294 1.1 cgd if (op->mileage + 50 >= End) {
295 1.1 cgd *value = (End == 700 && !cango);
296 1.1 cgd break;
297 1.1 cgd }
298 1.1 cgd if (canstop || (cango && !op->can_go))
299 1.1 cgd *value = 1;
300 1.1 cgd else {
301 1.1 cgd *value = (pp->safety[S_RIGHT_WAY] !=
302 1.1 cgd S_UNKNOWN ? 2 : 3);
303 1.1 cgd safe = S_RIGHT_WAY;
304 1.1 cgd oppos = C_END_LIMIT;
305 1.1 cgd goto normbad;
306 1.1 cgd }
307 1.1 cgd break;
308 1.1 cgd case C_CRASH: case C_EMPTY: case C_FLAT:
309 1.1 cgd safe = safety(card) - S_CONV;
310 1.1 cgd oppos = opposite(card);
311 1.1 cgd *value = (pp->safety[safe]!=S_UNKNOWN ? 3 : 4);
312 1.1 cgd normbad:
313 1.1 cgd if (op->safety[safe] == S_PLAYED)
314 1.1 cgd *value = -1;
315 1.1 cgd else {
316 1.1 cgd *value *= Numneed[oppos] +
317 1.1 cgd Numseen[oppos] + 2;
318 1.1 cgd if (!pp->mileage || foundend ||
319 1.1 cgd onecard(op))
320 1.1 cgd *value += 5;
321 1.1 cgd if (op->mileage == 0 || onecard(op))
322 1.1 cgd *value += 5;
323 1.1 cgd if (op->speed == C_LIMIT)
324 1.1 cgd *value -= 3;
325 1.1 cgd if (cango &&
326 1.1 cgd pp->safety[safe] != S_UNKNOWN)
327 1.1 cgd *value += 3;
328 1.1 cgd if (!cango)
329 1.1 cgd *value /= ++badcount;
330 1.1 cgd }
331 1.1 cgd break;
332 1.1 cgd case C_STOP:
333 1.1 cgd if (op->safety[S_RIGHT_WAY] == S_PLAYED)
334 1.1 cgd *value = -1;
335 1.1 cgd else {
336 1.1 cgd *value = (pp->safety[S_RIGHT_WAY] !=
337 1.1 cgd S_UNKNOWN ? 3 : 4);
338 1.1 cgd *value *= Numcards[C_STOP] +
339 1.1 cgd Numseen[C_GO];
340 1.1 cgd if (!pp->mileage || foundend ||
341 1.1 cgd onecard(op))
342 1.1 cgd *value += 5;
343 1.1 cgd if (!cango)
344 1.1 cgd *value /= ++badcount;
345 1.1 cgd if (op->mileage == 0)
346 1.1 cgd *value += 5;
347 1.10 christos if (op->speed == C_LIMIT || !op->can_go)
348 1.1 cgd *value -= 5;
349 1.1 cgd if (cango && pp->safety[S_RIGHT_WAY] !=
350 1.1 cgd S_UNKNOWN)
351 1.1 cgd *value += 5;
352 1.1 cgd }
353 1.1 cgd break;
354 1.1 cgd case C_GAS_SAFE: case C_DRIVE_SAFE:
355 1.1 cgd case C_SPARE_SAFE: case C_RIGHT_WAY:
356 1.1 cgd *value = cango ? 0 : 101;
357 1.1 cgd break;
358 1.1 cgd case C_INIT:
359 1.1 cgd *value = 0;
360 1.1 cgd break;
361 1.1 cgd }
362 1.1 cgd }
363 1.1 cgd else
364 1.1 cgd *value = cango ? 0 : 101;
365 1.1 cgd if (card != C_INIT) {
366 1.1 cgd if (*value >= curmax) {
367 1.1 cgd nummax = i;
368 1.1 cgd curmax = *value;
369 1.1 cgd }
370 1.1 cgd if (*value <= curmin) {
371 1.1 cgd nummin = i;
372 1.1 cgd curmin = *value;
373 1.1 cgd }
374 1.1 cgd }
375 1.1 cgd #ifdef DEBUG
376 1.1 cgd if (Debug)
377 1.1 cgd mvprintw(i + 6, 2, "%3d %-14s", *value,
378 1.1 cgd C_name[pp->hand[i]]);
379 1.1 cgd #endif
380 1.1 cgd value++;
381 1.1 cgd }
382 1.8 jsm if (!pp->can_go && !is_repair(pp->battle))
383 1.1 cgd Numneed[opposite(pp->battle)]++;
384 1.1 cgd if (cango) {
385 1.1 cgd play_it:
386 1.1 cgd mvaddstr(MOVE_Y + 1, MOVE_X, "PLAY\n");
387 1.3 jtc Movetype = M_PLAY;
388 1.3 jtc Card_no = nummax;
389 1.1 cgd }
390 1.1 cgd else {
391 1.8 jsm if (is_safety(pp->hand[nummin])) { /* NEVER discard a safety */
392 1.1 cgd nummax = nummin;
393 1.1 cgd goto play_it;
394 1.1 cgd }
395 1.1 cgd mvaddstr(MOVE_Y + 1, MOVE_X, "DISCARD\n");
396 1.3 jtc Movetype = M_DISCARD;
397 1.3 jtc Card_no = nummin;
398 1.1 cgd }
399 1.1 cgd mvprintw(MOVE_Y + 2, MOVE_X, "%16s", C_name[pp->hand[Card_no]]);
400 1.1 cgd }
401 1.1 cgd
402 1.3 jtc /*
403 1.3 jtc * Return true if the given player could conceivably win with his next card.
404 1.3 jtc */
405 1.5 lukem int
406 1.11 dholland onecard(const PLAY *pp)
407 1.1 cgd {
408 1.5 lukem CARD bat, spd, card;
409 1.1 cgd
410 1.1 cgd bat = pp->battle;
411 1.1 cgd spd = pp->speed;
412 1.1 cgd card = -1;
413 1.8 jsm if (pp->can_go || ((is_repair(bat) || bat == C_STOP || spd == C_LIMIT) &&
414 1.1 cgd Numseen[S_RIGHT_WAY] != 0) ||
415 1.5 lukem (bat >= 0 && Numseen[safety(bat)] != 0))
416 1.1 cgd switch (End - pp->mileage) {
417 1.1 cgd case 200:
418 1.1 cgd if (pp->nummiles[C_200] == 2)
419 1.1 cgd return FALSE;
420 1.1 cgd card = C_200;
421 1.1 cgd /* FALLTHROUGH */
422 1.1 cgd case 100:
423 1.1 cgd case 75:
424 1.1 cgd if (card == -1)
425 1.1 cgd card = (End - pp->mileage == 75 ? C_75 : C_100);
426 1.1 cgd if (spd == C_LIMIT)
427 1.1 cgd return Numseen[S_RIGHT_WAY] == 0;
428 1.14 mrg /* FALLTHROUGH */
429 1.1 cgd case 50:
430 1.1 cgd case 25:
431 1.1 cgd if (card == -1)
432 1.1 cgd card = (End - pp->mileage == 25 ? C_25 : C_50);
433 1.1 cgd return Numseen[card] != Numcards[card];
434 1.1 cgd }
435 1.1 cgd return FALSE;
436 1.1 cgd }
437 1.1 cgd
438 1.5 lukem int
439 1.11 dholland canplay(const PLAY *pp, const PLAY *op, CARD card)
440 1.1 cgd {
441 1.1 cgd switch (card) {
442 1.1 cgd case C_200:
443 1.1 cgd if (pp->nummiles[C_200] == 2)
444 1.1 cgd break;
445 1.1 cgd /* FALLTHROUGH */
446 1.1 cgd case C_75: case C_100:
447 1.1 cgd if (pp->speed == C_LIMIT)
448 1.1 cgd break;
449 1.1 cgd /* FALLTHROUGH */
450 1.1 cgd case C_50:
451 1.1 cgd if (pp->mileage + Value[card] > End)
452 1.1 cgd break;
453 1.1 cgd /* FALLTHROUGH */
454 1.1 cgd case C_25:
455 1.1 cgd if (pp->can_go)
456 1.1 cgd return TRUE;
457 1.1 cgd break;
458 1.1 cgd case C_EMPTY: case C_FLAT: case C_CRASH:
459 1.1 cgd case C_STOP:
460 1.1 cgd if (op->can_go && op->safety[safety(card) - S_CONV] != S_PLAYED)
461 1.1 cgd return TRUE;
462 1.1 cgd break;
463 1.1 cgd case C_LIMIT:
464 1.1 cgd if (op->speed != C_LIMIT &&
465 1.1 cgd op->safety[S_RIGHT_WAY] != S_PLAYED &&
466 1.1 cgd op->mileage + 50 < End)
467 1.1 cgd return TRUE;
468 1.1 cgd break;
469 1.1 cgd case C_GAS: case C_SPARE: case C_REPAIRS:
470 1.1 cgd if (pp->battle == opposite(card))
471 1.1 cgd return TRUE;
472 1.1 cgd break;
473 1.1 cgd case C_GO:
474 1.1 cgd if (!pp->can_go &&
475 1.8 jsm (is_repair(pp->battle) || pp->battle == C_STOP))
476 1.1 cgd return TRUE;
477 1.1 cgd break;
478 1.1 cgd case C_END_LIMIT:
479 1.1 cgd if (pp->speed == C_LIMIT)
480 1.1 cgd return TRUE;
481 1.1 cgd }
482 1.1 cgd return FALSE;
483 1.1 cgd }
484