Home | History | Annotate | Line # | Download | only in monop
monop.h revision 1.1.1.2
      1      1.1  cgd /*
      2  1.1.1.2  cgd  * Copyright (c) 1980, 1993
      3  1.1.1.2  cgd  *	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.1.2  cgd  *	@(#)monop.h	8.1 (Berkeley) 5/31/93
     34      1.1  cgd  */
     35      1.1  cgd 
     36      1.1  cgd # include	<stdio.h>
     37      1.1  cgd 
     38      1.1  cgd # define	reg	register
     39      1.1  cgd # define	shrt	char
     40      1.1  cgd # define	bool	char
     41      1.1  cgd # define	unsgn	unsigned
     42      1.1  cgd 
     43      1.1  cgd # define	TRUE	(1)
     44      1.1  cgd # define	FALSE	(0)
     45      1.1  cgd 
     46      1.1  cgd # define	N_MON	8	/* number of monopolies			*/
     47      1.1  cgd # define	N_PROP	22	/* number of normal property squares	*/
     48      1.1  cgd # define	N_RR	4	/* number of railroads			*/
     49      1.1  cgd # define	N_UTIL	2	/* number of utilities			*/
     50      1.1  cgd # define	N_SQRS	40	/* number of squares on board		*/
     51      1.1  cgd # define	MAX_PL	9	/* maximum number of players		*/
     52      1.1  cgd # define	MAX_PRP	(N_PROP+N_RR+N_UTIL) /* max # ownable property	*/
     53      1.1  cgd 
     54      1.1  cgd 				/* square type numbers			*/
     55      1.1  cgd # define	PRPTY	0	/* normal property			*/
     56      1.1  cgd # define	RR	1	/* railroad				*/
     57      1.1  cgd # define	UTIL	2	/* water works - electric co		*/
     58      1.1  cgd # define	SAFE	3	/* safe spot				*/
     59      1.1  cgd # define	CC	4	/* community chest			*/
     60      1.1  cgd # define	CHANCE	5	/* chance (surprise!!!)			*/
     61      1.1  cgd # define	INC_TAX	6	/* Income tax */
     62      1.1  cgd # define	GOTO_J	7	/* Go To Jail! */
     63      1.1  cgd # define	LUX_TAX	8	/* Luxury tax */
     64      1.1  cgd # define	IN_JAIL	9	/* In jail */
     65      1.1  cgd 
     66      1.1  cgd # define	JAIL	40	/* JAIL square number			*/
     67      1.1  cgd 
     68      1.1  cgd # define	lucky(str)	printf("%s%s\n",str,lucky_mes[roll(1,num_luck)-1])
     69      1.1  cgd # define	printline()	printf("------------------------------\n")
     70      1.1  cgd # define	sqnum(sqp)	(sqp - board)
     71      1.1  cgd # define	swap(A1,A2)	if ((A1) != (A2)) { \
     72      1.1  cgd 					(A1) ^= (A2); \
     73      1.1  cgd 					(A2) ^= (A1); \
     74      1.1  cgd 					(A1) ^= (A2); \
     75      1.1  cgd 				}
     76      1.1  cgd 
     77      1.1  cgd struct sqr_st {			/* structure for square			*/
     78      1.1  cgd 	char	*name;			/* place name			*/
     79      1.1  cgd 	shrt	owner;			/* owner number			*/
     80      1.1  cgd 	shrt	type;			/* place type			*/
     81      1.1  cgd 	struct prp_st	*desc;		/* description struct		*/
     82      1.1  cgd 	int	cost;			/* cost				*/
     83      1.1  cgd };
     84      1.1  cgd 
     85      1.1  cgd typedef struct sqr_st	SQUARE;
     86      1.1  cgd 
     87      1.1  cgd struct mon_st {			/* monopoly description structure	*/
     88      1.1  cgd 	char	*name;			/* monop. name (color)		*/
     89      1.1  cgd 	shrt	owner;			/* owner of monopoly		*/
     90      1.1  cgd 	shrt	num_in;			/* # in monopoly		*/
     91      1.1  cgd 	shrt	num_own;		/* # owned (-1: not poss. monop)*/
     92      1.1  cgd 	shrt	h_cost;			/* price of houses		*/
     93      1.1  cgd 	char	*not_m;			/* name if not monopoly		*/
     94      1.1  cgd 	char	*mon_n;			/* name if a monopoly		*/
     95      1.1  cgd 	char	sqnums[3];		/* Square numbers (used to init)*/
     96      1.1  cgd 	SQUARE	*sq[3];			/* list of squares in monop	*/
     97      1.1  cgd };
     98      1.1  cgd 
     99      1.1  cgd typedef struct mon_st	MON;
    100      1.1  cgd 
    101      1.1  cgd /*
    102      1.1  cgd  * This struct describes a property.  For railroads and utilities, only
    103      1.1  cgd  * the "morg" member is used.
    104      1.1  cgd  */
    105      1.1  cgd struct prp_st {			/* property description structure	*/
    106      1.1  cgd 	bool	morg;			/* set if mortgaged		*/
    107      1.1  cgd 	bool	monop;			/* set if monopoly		*/
    108      1.1  cgd 	shrt	square;			/* square description		*/
    109      1.1  cgd 	shrt	houses;			/* number of houses		*/
    110      1.1  cgd 	MON	*mon_desc;		/* name of color		*/
    111      1.1  cgd 	int	rent[6];		/* rents			*/
    112      1.1  cgd };
    113      1.1  cgd 
    114      1.1  cgd struct own_st {			/* element in list owned things		*/
    115      1.1  cgd 	SQUARE	*sqr;			/* pointer to square		*/
    116      1.1  cgd 	struct own_st	*next;		/* next in list			*/
    117      1.1  cgd };
    118      1.1  cgd 
    119      1.1  cgd typedef struct own_st	OWN;
    120      1.1  cgd 
    121      1.1  cgd struct plr_st {			/* player description structure		*/
    122      1.1  cgd 	char	*name;			/* owner name			*/
    123      1.1  cgd 	shrt	num_gojf;		/* # of get-out-of-jail-free's	*/
    124      1.1  cgd 	shrt	num_rr;			/* # of railroads owned		*/
    125      1.1  cgd 	shrt	num_util;		/* # of water works/elec. co.	*/
    126      1.1  cgd 	shrt	loc;			/* location on board		*/
    127      1.1  cgd 	shrt	in_jail;		/* count of turns in jail	*/
    128      1.1  cgd 	int	money;			/* amount of money		*/
    129      1.1  cgd 	OWN	*own_list;		/* start of propery list	*/
    130      1.1  cgd };
    131      1.1  cgd 
    132      1.1  cgd typedef struct plr_st	PLAY;
    133      1.1  cgd typedef struct prp_st	PROP;
    134      1.1  cgd typedef struct prp_st	RR_S;
    135      1.1  cgd typedef struct prp_st	UTIL_S;
    136      1.1  cgd 
    137      1.1  cgd int	cc(), chance(), lux_tax(), goto_jail(), inc_tax();
    138