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