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