2 * Copyright (c) 1982, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * @(#)mille.h 8.1 (Berkeley) 5/31/93
38 # include <sys/types.h>
47 * @(#)mille.h 1.1 (Berkeley) 4/1/82
51 * Miscellaneous constants
54 # define unsgn unsigned
57 # define HAND_SZ 7 /* number of cards in a hand */
58 # define DECK_SZ 101 /* number of cards in decks */
59 # define NUM_SAFE 4 /* number of saftey cards */
60 # define NUM_MILES 5 /* number of milestones types */
61 # define NUM_CARDS 20 /* number of types of cards */
62 # define BOARD_Y 17 /* size of board screen */
64 # define MILES_Y 7 /* size of mileage screen */
66 # define SCORE_Y 17 /* size of score screen */
68 # define MOVE_Y 10 /* Where to print move prompt */
70 # define ERR_Y 15 /* Where to print errors */
72 # define EXT_Y 4 /* Where to put Extension */
78 # define W_SMALL 0 /* Small (initial) window */
79 # define W_FULL 1 /* Full (final) window */
94 # define SC_SAFETY 100
95 # define SC_ALL_SAFE 300
100 # define SC_EXTENSION 200
101 # define SC_SHUT_OUT 500
104 * safety descriptions
107 # define S_UNKNOWN 0 /* location of safety unknown */
108 # define S_IN_HAND 1 /* safety in player's hand */
109 # define S_PLAYED 2 /* safety has been played */
110 # define S_GAS_SAFE 0 /* Gas safety card index */
111 # define S_SPARE_SAFE 1 /* Tire safety card index */
112 # define S_DRIVE_SAFE 2 /* Driveing safety card index */
113 # define S_RIGHT_WAY 3 /* Right-of-Way card index */
114 # define S_CONV 15 /* conversion from C_ to S_ */
133 # define C_REPAIRS 12
135 # define C_END_LIMIT 14
136 # define C_GAS_SAFE 15
137 # define C_SPARE_SAFE 16
138 # define C_DRIVE_SAFE 17
139 # define C_RIGHT_WAY 18
145 # define MOVEPROMPT 0
146 # define REALLYPROMPT 1
147 # define ANOTHERHANDPROMPT 2
148 # define ANOTHERGAMEPROMPT 3
149 # define SAVEGAMEPROMPT 4
150 # define SAMEFILEPROMPT 5
151 # define FILEPROMPT 6
152 # define EXTENSIONPROMPT 7
153 # define OVERWRITEFILEPROMPT 8
156 # define srandom(x) srand(x)
157 # define random() rand()
160 # if defined(SYSV) || defined(__FreeBSD__)
162 # define erasechar() _tty.c_cc[VERASE]
163 # define killchar() _tty.c_cc[VKILL]
167 # define erasechar() _tty.sg_erase
168 # define killchar() _tty.sg_kill
173 bool coups[NUM_SAFE];
177 short safety[NUM_SAFE];
178 short sh_safety[NUM_SAFE];
179 short nummiles[NUM_MILES];
180 short sh_nummiles[NUM_MILES];
182 CARD sh_hand[HAND_SZ];
205 # define other(x) (1 - x)
206 # define nextplay() (Play = other(Play))
207 # define nextwin(x) (1 - x)
208 # define opposite(x) (Opposite[x])
209 # define issafety(x) (x >= C_GAS_SAFE)
215 extern bool Debug, Finished, Next, On_exit, Order, Saved;
217 extern const char *C_fmt, **C_name;
218 extern char *Fromfile, Initstr[];
220 extern int Card_no, End, Handstart, Movetype, Numcards[], Numgos,
221 Numneed[], Numseen[NUM_CARDS], Play, Value[], Window;
223 extern CARD Deck[DECK_SZ], Discard, Opposite[NUM_CARDS], Sh_discard,
228 extern PLAY Player[2];
230 extern WINDOW *Board, *Miles, *Score;
238 bool canplay(PLAY *, PLAY *, CARD);
239 bool check_ext(bool);
240 void check_more(void);
243 bool error(const char *, ...);
245 void extrapolate(PLAY *);
247 void finalscore(PLAY *);
254 bool onecard(PLAY *);
266 void varpush(int, int (*)(int, void *, size_t));