2 * Copyright (c) 1980, 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. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * @(#)cribbage.h 8.1 (Berkeley) 5/31/93
33 extern CARD deck
[ CARDS
]; /* a deck */
34 extern CARD phand
[ FULLHAND
]; /* player's hand */
35 extern CARD chand
[ FULLHAND
]; /* computer's hand */
36 extern CARD crib
[ CINHAND
]; /* the crib */
37 extern CARD turnover
; /* the starter */
39 extern CARD known
[ CARDS
]; /* cards we have seen */
40 extern int knownum
; /* # of cards we know */
42 extern int pscore
; /* player's score */
43 extern int cscore
; /* comp's score */
44 extern int glimit
; /* points to win game */
46 extern int pgames
; /* player's games won */
47 extern int cgames
; /* comp's games won */
48 extern int gamecount
; /* # games played */
49 extern int Lastscore
[2]; /* previous score for each */
51 extern bool iwon
; /* if comp won last */
52 extern bool explain
; /* player mistakes explained */
53 extern bool rflag
; /* if all cuts random */
54 extern bool quiet
; /* if suppress random mess */
56 extern char explstr
[]; /* string for explanation */
58 void addmsg(const char *, ...) __printflike(1, 2);
60 bool anymove(CARD
[], int, int);
62 int cchose(CARD
[], int, int);
64 bool chkscr(int *, int);
65 bool comphand(CARD
[], const char *);
66 void cremove(CARD
, CARD
[], int);
71 int infrom(CARD
[], int, const char *);
72 void instructions(void);
73 void intr(int) __dead2
;
74 bool isone(CARD
, CARD
[], int);
75 void makedeck(CARD
[]);
76 void makeknown(CARD
[], int);
77 void msg(const char *, ...) __printflike(1, 2);
78 bool msgcard(CARD
, bool);
79 int number(int, int, const char *);
80 int pegscore(CARD
, CARD
[], int, int);
81 bool plyrhand(CARD
[], const char *);
82 void prcard(WINDOW
*, int, int, CARD
, bool);
83 void prhand(CARD
[], int, WINDOW
*, bool);
84 int scorehand(CARD
[], CARD
, int, bool, bool);
85 void shuffle(CARD
[]);
86 void sorthand(CARD
[], int);