xref: /netbsd/games/cribbage/cribbage.h (revision bf9ec67e)
1 /*	$NetBSD: cribbage.h,v 1.7 1999/09/30 18:01:32 jsm Exp $	*/
2 
3 /*
4  * Copyright (c) 1980, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *	This product includes software developed by the University of
18  *	California, Berkeley and its contributors.
19  * 4. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  *	@(#)cribbage.h	8.1 (Berkeley) 5/31/93
36  */
37 
38 extern  CARD		deck[ CARDS ];		/* a deck */
39 extern  CARD		phand[ FULLHAND ];	/* player's hand */
40 extern  CARD		chand[ FULLHAND ];	/* computer's hand */
41 extern  CARD		crib[ CINHAND ];	/* the crib */
42 extern  CARD		turnover;		/* the starter */
43 
44 extern  CARD		known[ CARDS ];		/* cards we have seen */
45 extern  int		knownum;		/* # of cards we know */
46 
47 extern  int		pscore;			/* player's score */
48 extern  int		cscore;			/* comp's score */
49 extern  int		glimit;			/* points to win game */
50 
51 extern  int		pgames;			/* player's games won */
52 extern  int		cgames;			/* comp's games won */
53 extern  int		gamecount;		/* # games played */
54 extern	int		Lastscore[2];		/* previous score for each */
55 
56 extern  BOOLEAN		iwon;			/* if comp won last */
57 extern  BOOLEAN		explain;		/* player mistakes explained */
58 extern  BOOLEAN		rflag;			/* if all cuts random */
59 extern  BOOLEAN		quiet;			/* if suppress random mess */
60 extern	BOOLEAN		playing;		/* currently playing game */
61 
62 extern  char		expl[];			/* string for explanation */
63 
64 void	 addmsg __P((const char *, ...));
65 int	 adjust __P((const CARD [], CARD));
66 int	 anymove __P((const CARD [], int, int));
67 int	 anysumto __P((const CARD [], int, int, int));
68 void	 bye __P((void));
69 int	 cchose __P((const CARD [], int, int));
70 void	 cdiscard __P((BOOLEAN));
71 int	 chkscr __P((int *, int));
72 int	 comphand __P((const CARD [], const char *));
73 void	 cremove __P((CARD, CARD [], int));
74 int	 cut __P((BOOLEAN, int));
75 int	 deal __P((int));
76 void	 discard __P((BOOLEAN));
77 void	 do_wait __P((void));
78 void	 endmsg __P((void));
79 int	 eq __P((CARD, CARD));
80 int	 fifteens __P((const CARD [], int));
81 void	 game __P((void));
82 void	 gamescore __P((void));
83 char	*getline __P((void));
84 int	 getuchar __P((void));
85 int	 incard __P((CARD *));
86 int	 infrom __P((const CARD [], int, const char *));
87 void	 instructions __P((void));
88 int	 is_one __P((CARD, const CARD [], int));
89 void	 makeboard __P((void));
90 void	 makedeck __P((CARD []));
91 void	 makeknown __P((const CARD [], int));
92 void	 msg __P((const char *, ...));
93 int	 msgcard __P((CARD, BOOLEAN));
94 int	 msgcrd __P((CARD, BOOLEAN, const char *, BOOLEAN));
95 int	 number __P((int, int, const char *));
96 int	 numofval __P((const CARD [], int, int));
97 int	 pairuns __P((const CARD [], int));
98 int	 peg __P((BOOLEAN));
99 int	 pegscore __P((CARD, const CARD [], int, int));
100 int	 playhand __P((BOOLEAN));
101 int	 plyrhand __P((const CARD [], const char *));
102 void	 prcard __P((WINDOW *, int, int, CARD, BOOLEAN));
103 void	 prcrib __P((BOOLEAN, BOOLEAN));
104 void	 prhand __P((const CARD [], int, WINDOW *, BOOLEAN));
105 void	 printcard __P((WINDOW *, int, CARD, BOOLEAN));
106 void	 prpeg __P((int, int, BOOLEAN));
107 void	 prtable __P((int));
108 int	 readchar __P((void));
109 void	 rint __P((int)) __attribute__((__noreturn__));
110 int	 score __P((BOOLEAN));
111 int	 scorehand __P((const CARD [], CARD, int, BOOLEAN, BOOLEAN));
112 void	 shuffle __P((CARD []));
113 void	 sorthand __P((CARD [], int));
114 void	 wait_for __P((int));
115