1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245
|
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)cribbage.h 5.1 (Berkeley) 5/30/85
*/
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
extern CARD deck[ CARDS ]; /* a deck */
extern CARD phand[ FULLHAND ]; /* player's hand */
extern CARD chand[ FULLHAND ]; /* computer's hand */
extern CARD crib[ CINHAND ]; /* the crib */
extern CARD turnover; /* the starter */
extern CARD known[ CARDS ]; /* cards we have seen */
extern int knownum; /* # of cards we know */
extern int pscore; /* player's score */
extern int cscore; /* comp's score */
extern int glimit; /* points to win game */
extern int pgames; /* player's games won */
extern int cgames; /* comp's games won */
extern int gamecount; /* # games played */
extern int Lastscore[2]; /* previous score for each */
extern BOOLEAN iwon; /* if comp won last */
extern BOOLEAN explain; /* player mistakes explained */
extern BOOLEAN rflag; /* if all cuts random */
extern BOOLEAN quiet; /* if suppress random mess */
extern BOOLEAN playing; /* currently playing game */
extern char c_expl[]; /* string for explanation */
#define expl c_expl
#define PLAYER 0
#define COMPUTER 1
#define TABLE 2
#define getline crib_getline
void
UIInit (int argc, char **argv);
void
UISuspend (void);
void
UIResume (void);
void
UIFinish (void);
void
UIInitBoard (void);
void
UIGameScore (int who, int num);
void
UIRefresh (void);
void
UIWait (void);
void
UIPause(void);
void
UIEraseHand (int who);
void
UIClearHand (int who);
void
UIPrintHand (CARD *h, int n, int who, BOOLEAN blank);
void
UIPrintCrib (int who, CARD *card, BOOLEAN blank);
void
UITableScore (int score, int n);
void
UIPrintPeg (int score, BOOLEAN on, int who);
void
ShowCursor (void);
void
HideCursor (void);
int
UIReadChar (void);
void
UIEchoChar (char c);
void
UIReadLine (char *buf, int len);
void
UIMessage (char *str, int newline);
int
UIGetMessageSize (void);
void
UIClearMsg (void);
int
UIGetPlayerCard (CARD *hand, int n, char *prompt);
void
msg(char *fmt, ...);
void
addmsg(char *fmt, ...);
int
msgcard(CARD c, BOOLEAN brief);
int
msgcrd(CARD c, BOOLEAN brfrank, char *mid, BOOLEAN brfsuit);
int
getuchar(void);
int
number(int lo, int hi, char *prompt);
void
msg(char *fmt, ...);
void
addmsg(char *fmt, ...);
void
endmsg(BOOLEAN newline);
void
doadd(char *fmt, va_list args);
char *
getline(void);
void
quit(int status);
void
makeboard(void);
void
gamescore(void);
void
game(void);
BOOLEAN
playhand(BOOLEAN mycrib);
int
deal(int mycrib);
void
discard(BOOLEAN mycrib);
BOOLEAN
cut(BOOLEAN mycrib, int pos);
BOOLEAN
peg(BOOLEAN mycrib);
void
prtable(int score);
BOOLEAN
score(BOOLEAN mycrib);
void
makedeck( CARD *d );
void
shuffle( CARD *d );
BOOLEAN
eq( CARD a, CARD b );
BOOLEAN
isone( CARD a, CARD *b, int n );
void
remove_card( CARD a, CARD *d, int n );
void
sorthand(CARD *h, int n);
int
cchose( CARD *h, int n, int s );
BOOLEAN
plyrhand(CARD *hand, char *s);
BOOLEAN
comphand(CARD *h, char *s);
BOOLEAN
chkscr(int *scr, int inc);
void
cdiscard( BOOLEAN mycrib );
BOOLEAN
anymove( CARD *hand, int n, int sum );
int
anysumto( CARD *hand, int n, int s, int t );
int
numofval( CARD *h, int n, int v );
void
makeknown( CARD *h, int n );
int
scorehand(CARD *hand, CARD starter, int n, BOOLEAN crb, BOOLEAN do_explain);
int
fifteens(CARD *hand, int n);
int
pairuns( CARD *h, int n );
int
pegscore( CARD crd, CARD *tbl, int n, int sum );
int
adjust( CARD *cb, CARD tnv );
|