1*11c3b524SAaron LI /* $NetBSD: monop.c,v 1.27 2012/06/19 05:35:32 dholland Exp $ */
2*11c3b524SAaron LI
3*11c3b524SAaron LI /*
4*11c3b524SAaron LI * Copyright (c) 1980, 1993
5*11c3b524SAaron LI * The Regents of the University of California. All rights reserved.
6*11c3b524SAaron LI *
7*11c3b524SAaron LI * Redistribution and use in source and binary forms, with or without
8*11c3b524SAaron LI * modification, are permitted provided that the following conditions
9*11c3b524SAaron LI * are met:
10*11c3b524SAaron LI * 1. Redistributions of source code must retain the above copyright
11*11c3b524SAaron LI * notice, this list of conditions and the following disclaimer.
12*11c3b524SAaron LI * 2. Redistributions in binary form must reproduce the above copyright
13*11c3b524SAaron LI * notice, this list of conditions and the following disclaimer in the
14*11c3b524SAaron LI * documentation and/or other materials provided with the distribution.
15*11c3b524SAaron LI * 3. Neither the name of the University nor the names of its contributors
16*11c3b524SAaron LI * may be used to endorse or promote products derived from this software
17*11c3b524SAaron LI * without specific prior written permission.
18*11c3b524SAaron LI *
19*11c3b524SAaron LI * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20*11c3b524SAaron LI * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*11c3b524SAaron LI * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*11c3b524SAaron LI * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23*11c3b524SAaron LI * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*11c3b524SAaron LI * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25*11c3b524SAaron LI * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26*11c3b524SAaron LI * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27*11c3b524SAaron LI * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28*11c3b524SAaron LI * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29*11c3b524SAaron LI * SUCH DAMAGE.
30*11c3b524SAaron LI *
31*11c3b524SAaron LI * @(#)monop.c 8.1 (Berkeley) 5/31/93
32*11c3b524SAaron LI */
33*11c3b524SAaron LI
34*11c3b524SAaron LI #include <stdio.h>
35*11c3b524SAaron LI #include <signal.h>
36*11c3b524SAaron LI #include <stdlib.h>
37*11c3b524SAaron LI #include <time.h>
38*11c3b524SAaron LI #include <unistd.h>
39*11c3b524SAaron LI #include "deck.h"
40*11c3b524SAaron LI #include "monop.h"
41*11c3b524SAaron LI
42*11c3b524SAaron LI int main(int, char *[]);
43*11c3b524SAaron LI static void getplayers(void);
44*11c3b524SAaron LI static void init_players(void);
45*11c3b524SAaron LI static void init_monops(void);
46*11c3b524SAaron LI static void do_quit(int);
47*11c3b524SAaron LI
48*11c3b524SAaron LI
49*11c3b524SAaron LI bool fixing, /* set if fixing up debt */
50*11c3b524SAaron LI trading, /* set if in process of trading */
51*11c3b524SAaron LI told_em, /* set if told user he's out of debt */
52*11c3b524SAaron LI spec; /* set if moving by card to RR or UTIL */
53*11c3b524SAaron LI
54*11c3b524SAaron LI const char *name_list[MAX_PL+2]; /* list of players' names */
55*11c3b524SAaron LI static const char *const comlist[] = { /* list of normal commands */
56*11c3b524SAaron LI "quit", /* 0 */ "print", /* 1 */
57*11c3b524SAaron LI "where", /* 2 */ "own holdings", /* 3 */
58*11c3b524SAaron LI "holdings", /* 4 */ "mortgage", /* 5 */
59*11c3b524SAaron LI "unmortgage", /* 6 */ "buy houses", /* 7 */
60*11c3b524SAaron LI "sell houses", /* 8 */ "card", /* 9 */
61*11c3b524SAaron LI "pay", /* 10 */ "trade", /* 11 */
62*11c3b524SAaron LI "resign", /* 12 */ "save", /* 13 */
63*11c3b524SAaron LI "restore", /* 14 */ "roll", /* 15 */
64*11c3b524SAaron LI "", /* 16 */
65*11c3b524SAaron LI 0
66*11c3b524SAaron LI };
67*11c3b524SAaron LI const char *const yncoms[] = { /* list of commands for yes/no answers */
68*11c3b524SAaron LI "yes", /* 0 */ "no", /* 1 */
69*11c3b524SAaron LI "quit", /* 2 */ "print", /* 3 */
70*11c3b524SAaron LI "where", /* 4 */ "own holdings", /* 5 */
71*11c3b524SAaron LI "holdings", /* 6 */
72*11c3b524SAaron LI 0
73*11c3b524SAaron LI };
74*11c3b524SAaron LI const char *const lucky_mes[] = { /* "got lucky" messages */
75*11c3b524SAaron LI "You lucky stiff", "You got lucky",
76*11c3b524SAaron LI "What a lucky person!", "You must have a 4-leaf clover",
77*11c3b524SAaron LI "My, my! Aren't we lucky!", "Luck smiles upon you",
78*11c3b524SAaron LI "You got lucky this time", "Lucky person!",
79*11c3b524SAaron LI "Your karma must certainly be together",
80*11c3b524SAaron LI "How beautifully Cosmic", "Wow, you must be really with it"
81*11c3b524SAaron LI /* "I want your autograph", -- Save for later */
82*11c3b524SAaron LI };
83*11c3b524SAaron LI
84*11c3b524SAaron LI int player, /* current player number */
85*11c3b524SAaron LI num_play, /* current number of players */
86*11c3b524SAaron LI num_doub, /* # of doubles current player rolled */
87*11c3b524SAaron LI /* # of "got lucky" messages */
88*11c3b524SAaron LI num_luck = sizeof lucky_mes / sizeof (char *);
89*11c3b524SAaron LI
90*11c3b524SAaron LI /* list of command functions */
91*11c3b524SAaron LI void (*const func[])(void) = { /* array of function calls for commands */
92*11c3b524SAaron LI quit, /* quit game |* 0 *| */
93*11c3b524SAaron LI printboard, /* print board |* 1 *| */
94*11c3b524SAaron LI where, /* where players are |* 2 *| */
95*11c3b524SAaron LI list, /* own holdings |* 3 *| */
96*11c3b524SAaron LI list_all, /* holdings list |* 4 *| */
97*11c3b524SAaron LI mortgage, /* mortgage property |* 5 *| */
98*11c3b524SAaron LI unmortgage, /* unmortgage property |* 6 *| */
99*11c3b524SAaron LI buy_houses, /* buy houses |* 7 *| */
100*11c3b524SAaron LI sell_houses, /* sell houses |* 8 *| */
101*11c3b524SAaron LI card, /* card for jail |* 9 *| */
102*11c3b524SAaron LI pay, /* pay for jail |* 10 *| */
103*11c3b524SAaron LI trade, /* trade |* 11 *| */
104*11c3b524SAaron LI resign, /* resign |* 12 *| */
105*11c3b524SAaron LI save, /* save game |* 13 *| */
106*11c3b524SAaron LI restore, /* restore game |* 14 *| */
107*11c3b524SAaron LI do_move, /* roll |* 15 *| */
108*11c3b524SAaron LI do_move /* "" |* 16 *| */
109*11c3b524SAaron LI };
110*11c3b524SAaron LI
111*11c3b524SAaron LI DECK deck[2]; /* Chance and Community Chest */
112*11c3b524SAaron LI
113*11c3b524SAaron LI PLAY *play, /* player structure array ("calloc"ed) */
114*11c3b524SAaron LI *cur_p; /* pointer to current player's struct */
115*11c3b524SAaron LI
116*11c3b524SAaron LI static RR_S rr[N_RR]; /* railroad descriptions */
117*11c3b524SAaron LI
118*11c3b524SAaron LI static UTIL_S util[2]; /* utility descriptions */
119*11c3b524SAaron LI
120*11c3b524SAaron LI #define MONINIT(num_in, h_cost, not_m, mon_n, sq1,sq2,sq3) \
121*11c3b524SAaron LI {0, -1, num_in, 0, h_cost, not_m, mon_n, {sq1,sq2,sq3}, {0,0,0}}
122*11c3b524SAaron LI /* name owner num_own sq */
123*11c3b524SAaron LI
124*11c3b524SAaron LI static MON mon[N_MON] = { /* monopoly descriptions */
125*11c3b524SAaron LI /* num_in h_cost not_m mon_n sqnums */
126*11c3b524SAaron LI MONINIT(2, 1, "Purple", "PURPLE", 1,3, 0),
127*11c3b524SAaron LI MONINIT(3, 1, "Lt. Blue", "LT. BLUE", 6,8,9),
128*11c3b524SAaron LI MONINIT(3, 2, "Violet", "VIOLET", 11,13,14),
129*11c3b524SAaron LI MONINIT(3, 2, "Orange", "ORANGE", 16,18,19),
130*11c3b524SAaron LI MONINIT(3, 3, "Red", "RED", 21,23,24),
131*11c3b524SAaron LI MONINIT(3, 3, "Yellow", "YELLOW", 26,27,29),
132*11c3b524SAaron LI MONINIT(3, 4, "Green", "GREEN", 31,32,34),
133*11c3b524SAaron LI MONINIT(2, 4, "Dk. Blue", "DK. BLUE", 37,39, 0),
134*11c3b524SAaron LI };
135*11c3b524SAaron LI #undef MONINIT
136*11c3b524SAaron LI
137*11c3b524SAaron LI PROP prop[N_PROP] = { /* typical properties */
138*11c3b524SAaron LI /* morg monop square houses mon_desc rent */
139*11c3b524SAaron LI {0, 0, 1, 0, &mon[0], { 2, 10, 30, 90, 160, 250} },
140*11c3b524SAaron LI {0, 0, 3, 0, &mon[0], { 4, 20, 60, 180, 320, 450} },
141*11c3b524SAaron LI {0, 0, 6, 0, &mon[1], { 6, 30, 90, 270, 400, 550} },
142*11c3b524SAaron LI {0, 0, 7, 0, &mon[1], { 6, 30, 90, 270, 400, 550} },
143*11c3b524SAaron LI {0, 0, 9, 0, &mon[1], { 8, 40,100, 300, 450, 600} },
144*11c3b524SAaron LI {0, 0, 11, 0, &mon[2], {10, 50,150, 450, 625, 750} },
145*11c3b524SAaron LI {0, 0, 13, 0, &mon[2], {10, 50,150, 450, 625, 750} },
146*11c3b524SAaron LI {0, 0, 14, 0, &mon[2], {12, 60,180, 500, 700, 900} },
147*11c3b524SAaron LI {0, 0, 16, 0, &mon[3], {14, 70,200, 550, 750, 950} },
148*11c3b524SAaron LI {0, 0, 17, 0, &mon[3], {14, 70,200, 550, 750, 950} },
149*11c3b524SAaron LI {0, 0, 19, 0, &mon[3], {16, 80,220, 600, 800,1000} },
150*11c3b524SAaron LI {0, 0, 21, 0, &mon[4], {18, 90,250, 700, 875,1050} },
151*11c3b524SAaron LI {0, 0, 23, 0, &mon[4], {18, 90,250, 700, 875,1050} },
152*11c3b524SAaron LI {0, 0, 24, 0, &mon[4], {20,100,300, 750, 925,1100} },
153*11c3b524SAaron LI {0, 0, 26, 0, &mon[5], {22,110,330, 800, 975,1150} },
154*11c3b524SAaron LI {0, 0, 27, 0, &mon[5], {22,110,330, 800, 975,1150} },
155*11c3b524SAaron LI {0, 0, 29, 0, &mon[5], {24,120,360, 850,1025,1200} },
156*11c3b524SAaron LI {0, 0, 31, 0, &mon[6], {26,130,390, 900,1100,1275} },
157*11c3b524SAaron LI {0, 0, 32, 0, &mon[6], {26,130,390, 900,1100,1275} },
158*11c3b524SAaron LI {0, 0, 34, 0, &mon[6], {28,150,450,1000,1200,1400} },
159*11c3b524SAaron LI {0, 0, 37, 0, &mon[7], {35,175,500,1100,1300,1500} },
160*11c3b524SAaron LI {0, 0, 39, 0, &mon[7], {50,200,600,1400,1700,2000} }
161*11c3b524SAaron LI };
162*11c3b524SAaron LI
163*11c3b524SAaron LI SQUARE board[N_SQRS+1] = { /* board itself (+1 for Jail) */
164*11c3b524SAaron LI /* name (COLOR) owner type desc cost */
165*11c3b524SAaron LI
166*11c3b524SAaron LI {"=== GO ===", -1, SAFE, NULL, 0 },
167*11c3b524SAaron LI {"Mediterranean Ave. (P)", -1, PRPTY, &prop[0], 60 },
168*11c3b524SAaron LI {"Community Chest i", -1, CC, NULL, 0 },
169*11c3b524SAaron LI {"Baltic Ave. (P)", -1, PRPTY, &prop[1], 60 },
170*11c3b524SAaron LI {"Income Tax", -1, INC_TAX, NULL, 0 },
171*11c3b524SAaron LI {"Reading RR", -1, RR, &rr[0], 200 },
172*11c3b524SAaron LI {"Oriental Ave. (L)", -1, PRPTY, &prop[2], 100 },
173*11c3b524SAaron LI {"Chance i", -1, CHANCE, NULL, 0 },
174*11c3b524SAaron LI {"Vermont Ave. (L)", -1, PRPTY, &prop[3], 100 },
175*11c3b524SAaron LI {"Connecticut Ave. (L)", -1, PRPTY, &prop[4], 120 },
176*11c3b524SAaron LI {"Just Visiting", -1, SAFE, NULL, 0 },
177*11c3b524SAaron LI {"St. Charles Pl. (V)", -1, PRPTY, &prop[5], 140 },
178*11c3b524SAaron LI {"Electric Co.", -1, UTIL, &util[0], 150 },
179*11c3b524SAaron LI {"States Ave. (V)", -1, PRPTY, &prop[6], 140 },
180*11c3b524SAaron LI {"Virginia Ave. (V)", -1, PRPTY, &prop[7], 160 },
181*11c3b524SAaron LI {"Pennsylvania RR", -1, RR, &rr[1], 200 },
182*11c3b524SAaron LI {"St. James Pl. (O)", -1, PRPTY, &prop[8], 180 },
183*11c3b524SAaron LI {"Community Chest ii", -1, CC, NULL, 0 },
184*11c3b524SAaron LI {"Tennessee Ave. (O)", -1, PRPTY, &prop[9], 180 },
185*11c3b524SAaron LI {"New York Ave. (O)", -1, PRPTY, &prop[10], 200 },
186*11c3b524SAaron LI {"Free Parking", -1, SAFE, NULL, 0 },
187*11c3b524SAaron LI {"Kentucky Ave. (R)", -1, PRPTY, &prop[11], 220 },
188*11c3b524SAaron LI {"Chance ii", -1, CHANCE, NULL, 0 },
189*11c3b524SAaron LI {"Indiana Ave. (R)", -1, PRPTY, &prop[12], 220 },
190*11c3b524SAaron LI {"Illinois Ave. (R)", -1, PRPTY, &prop[13], 240 },
191*11c3b524SAaron LI {"B&O RR", -1, RR, &rr[2], 200 },
192*11c3b524SAaron LI {"Atlantic Ave. (Y)", -1, PRPTY, &prop[14], 260 },
193*11c3b524SAaron LI {"Ventnor Ave. (Y)", -1, PRPTY, &prop[15], 260 },
194*11c3b524SAaron LI {"Water Works", -1, UTIL, &util[1], 150 },
195*11c3b524SAaron LI {"Marvin Gardens (Y)", -1, PRPTY, &prop[16], 280 },
196*11c3b524SAaron LI {"GO TO JAIL", -1, GOTO_J, NULL, 0 },
197*11c3b524SAaron LI {"Pacific Ave. (G)", -1, PRPTY, &prop[17], 300 },
198*11c3b524SAaron LI {"N. Carolina Ave. (G)", -1, PRPTY, &prop[18], 300 },
199*11c3b524SAaron LI {"Community Chest iii", -1, CC, NULL, 0 },
200*11c3b524SAaron LI {"Pennsylvania Ave. (G)", -1, PRPTY, &prop[19], 320 },
201*11c3b524SAaron LI {"Short Line RR", -1, RR, &rr[3], 200 },
202*11c3b524SAaron LI {"Chance iii", -1, CHANCE, NULL, 0 },
203*11c3b524SAaron LI {"Park Place (D)", -1, PRPTY, &prop[20], 350 },
204*11c3b524SAaron LI {"Luxury Tax", -1, LUX_TAX, NULL, 0 },
205*11c3b524SAaron LI {"Boardwalk (D)", -1, PRPTY, &prop[21], 400 },
206*11c3b524SAaron LI {"JAIL", -1, IN_JAIL, NULL, 0 }
207*11c3b524SAaron LI };
208*11c3b524SAaron LI
209*11c3b524SAaron LI
210*11c3b524SAaron LI /*
211*11c3b524SAaron LI * This program implements a monopoly game
212*11c3b524SAaron LI */
213*11c3b524SAaron LI int
main(int ac,char * av[])214*11c3b524SAaron LI main(int ac, char *av[])
215*11c3b524SAaron LI {
216*11c3b524SAaron LI /* Revoke setgid privileges */
217*11c3b524SAaron LI setgid(getgid());
218*11c3b524SAaron LI
219*11c3b524SAaron LI srandom((unsigned long)time(NULL));
220*11c3b524SAaron LI num_luck = sizeof lucky_mes / sizeof (char *);
221*11c3b524SAaron LI init_decks();
222*11c3b524SAaron LI init_monops();
223*11c3b524SAaron LI if (ac > 1) {
224*11c3b524SAaron LI if (rest_f(av[1]) < 0)
225*11c3b524SAaron LI restore();
226*11c3b524SAaron LI }
227*11c3b524SAaron LI else {
228*11c3b524SAaron LI getplayers();
229*11c3b524SAaron LI init_players();
230*11c3b524SAaron LI }
231*11c3b524SAaron LI signal(SIGINT, do_quit);
232*11c3b524SAaron LI for (;;) {
233*11c3b524SAaron LI printf("\n%s (%d) (cash $%d) on %s\n", cur_p->name, player + 1,
234*11c3b524SAaron LI cur_p->money, board[cur_p->loc].name);
235*11c3b524SAaron LI printturn();
236*11c3b524SAaron LI force_morg();
237*11c3b524SAaron LI execute(getinp("-- Command: ", comlist));
238*11c3b524SAaron LI }
239*11c3b524SAaron LI }
240*11c3b524SAaron LI
241*11c3b524SAaron LI /*ARGSUSED*/
242*11c3b524SAaron LI static void
do_quit(int n __unused)243*11c3b524SAaron LI do_quit(int n __unused)
244*11c3b524SAaron LI {
245*11c3b524SAaron LI quit();
246*11c3b524SAaron LI }
247*11c3b524SAaron LI
248*11c3b524SAaron LI /*
249*11c3b524SAaron LI * This routine gets the names of the players
250*11c3b524SAaron LI */
251*11c3b524SAaron LI static void
getplayers(void)252*11c3b524SAaron LI getplayers(void)
253*11c3b524SAaron LI {
254*11c3b524SAaron LI int i, j;
255*11c3b524SAaron LI char buf[257];
256*11c3b524SAaron LI
257*11c3b524SAaron LI blew_it:
258*11c3b524SAaron LI for (;;) {
259*11c3b524SAaron LI if ((num_play = get_int("How many players? ")) <= 1 ||
260*11c3b524SAaron LI num_play > MAX_PL)
261*11c3b524SAaron LI printf("Sorry. Number must range from 2 to %d\n",
262*11c3b524SAaron LI MAX_PL);
263*11c3b524SAaron LI else
264*11c3b524SAaron LI break;
265*11c3b524SAaron LI }
266*11c3b524SAaron LI cur_p = play = calloc((size_t)num_play, sizeof (PLAY));
267*11c3b524SAaron LI if (play == NULL)
268*11c3b524SAaron LI err(1, NULL);
269*11c3b524SAaron LI for (i = 0; i < num_play; i++) {
270*11c3b524SAaron LI do {
271*11c3b524SAaron LI printf("Player %d's name: ", i + 1);
272*11c3b524SAaron LI fgets(buf, sizeof(buf), stdin);
273*11c3b524SAaron LI if (feof(stdin)) {
274*11c3b524SAaron LI quit();
275*11c3b524SAaron LI }
276*11c3b524SAaron LI buf[strcspn(buf, "\n")] = '\0';
277*11c3b524SAaron LI } while (strlen(buf) == 0);
278*11c3b524SAaron LI name_list[i] = play[i].name = strdup(buf);
279*11c3b524SAaron LI if (name_list[i] == NULL)
280*11c3b524SAaron LI err(1, NULL);
281*11c3b524SAaron LI play[i].money = 1500;
282*11c3b524SAaron LI }
283*11c3b524SAaron LI name_list[i++] = "done";
284*11c3b524SAaron LI name_list[i] = 0;
285*11c3b524SAaron LI for (i = 0; i < num_play; i++)
286*11c3b524SAaron LI for (j = i + 1; j <= num_play; j++)
287*11c3b524SAaron LI if (strcasecmp(name_list[i], name_list[j]) == 0) {
288*11c3b524SAaron LI if (j != num_play)
289*11c3b524SAaron LI printf("Hey!!! Some of those are "
290*11c3b524SAaron LI "IDENTICAL!! Let's try that "
291*11c3b524SAaron LI "again...\n");
292*11c3b524SAaron LI else
293*11c3b524SAaron LI printf("\"done\" is a reserved word. "
294*11c3b524SAaron LI "Please try again\n");
295*11c3b524SAaron LI for (i = 0; i < num_play; i++)
296*11c3b524SAaron LI free(play[i].name);
297*11c3b524SAaron LI free(play);
298*11c3b524SAaron LI goto blew_it;
299*11c3b524SAaron LI }
300*11c3b524SAaron LI }
301*11c3b524SAaron LI
302*11c3b524SAaron LI /*
303*11c3b524SAaron LI * This routine figures out who goes first
304*11c3b524SAaron LI */
305*11c3b524SAaron LI static void
init_players(void)306*11c3b524SAaron LI init_players(void)
307*11c3b524SAaron LI {
308*11c3b524SAaron LI int i, rl, cur_max;
309*11c3b524SAaron LI bool over = 0;
310*11c3b524SAaron LI int max_pl = 0;
311*11c3b524SAaron LI
312*11c3b524SAaron LI again:
313*11c3b524SAaron LI putchar('\n');
314*11c3b524SAaron LI for (cur_max = i = 0; i < num_play; i++) {
315*11c3b524SAaron LI printf("%s (%d) rolls %d\n", play[i].name, i+1, rl=roll(2, 6));
316*11c3b524SAaron LI if (rl > cur_max) {
317*11c3b524SAaron LI over = FALSE;
318*11c3b524SAaron LI cur_max = rl;
319*11c3b524SAaron LI max_pl = i;
320*11c3b524SAaron LI }
321*11c3b524SAaron LI else if (rl == cur_max)
322*11c3b524SAaron LI over++;
323*11c3b524SAaron LI }
324*11c3b524SAaron LI if (over) {
325*11c3b524SAaron LI printf("%d people rolled the same thing, so we'll try again\n",
326*11c3b524SAaron LI over + 1);
327*11c3b524SAaron LI goto again;
328*11c3b524SAaron LI }
329*11c3b524SAaron LI player = max_pl;
330*11c3b524SAaron LI cur_p = &play[max_pl];
331*11c3b524SAaron LI printf("%s (%d) goes first\n", cur_p->name, max_pl + 1);
332*11c3b524SAaron LI }
333*11c3b524SAaron LI
334*11c3b524SAaron LI /*
335*11c3b524SAaron LI * This routine initializes the monopoly structures.
336*11c3b524SAaron LI */
337*11c3b524SAaron LI static void
init_monops(void)338*11c3b524SAaron LI init_monops(void)
339*11c3b524SAaron LI {
340*11c3b524SAaron LI MON *mp;
341*11c3b524SAaron LI int i;
342*11c3b524SAaron LI
343*11c3b524SAaron LI for (mp = mon; mp < &mon[N_MON]; mp++) {
344*11c3b524SAaron LI mp->name = mp->not_m;
345*11c3b524SAaron LI for (i = 0; i < mp->num_in; i++)
346*11c3b524SAaron LI mp->sq[i] = &board[mp->sqnums[i]];
347*11c3b524SAaron LI }
348*11c3b524SAaron LI }
349