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