DragonFly BSD
DragonFly submit List (threaded) for 2005-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[PATCH] games/cribbage WARNS6


From: Peter Avalos <pavalos@xxxxxxxxxxxx>
Date: Mon, 1 Aug 2005 06:22:24 -0700

Here's a patch to bring games/cribbage to WARNS6.

http://www.theshell.com/~pavalos/wip/cribbage.diff

--Peter


Index: games/cribbage/Makefile
===================================================================
RCS file: /home/dcvs/src/games/cribbage/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- games/cribbage/Makefile	17 Jun 2003 04:25:23 -0000	1.2
+++ games/cribbage/Makefile	1 Aug 2005 13:19:34 -0000
@@ -3,13 +3,14 @@
 # $DragonFly: src/games/cribbage/Makefile,v 1.2 2003/06/17 04:25:23 dillon Exp $
 
 PROG=	cribbage
-DPADD=	${LIBCURSES} ${LIBTERMCAP} ${LIBCOMPAT}
-LDADD=	-lcurses -ltermcap -lcompat
+DPADD=	${LIBCURSES}
+LDADD=	-lcurses
 SRCS=	extern.c crib.c cards.c instr.c io.c score.c support.c
 FILES=	cribbage.n
 FILESNAME_cribbage.n=	cribbage.instr
 MAN=	cribbage.6
 HIDEGAME=hidegame
+WARNS?=	6
 
 beforeinstall:
 .if !exists(${DESTDIR}/var/games/criblog)
Index: games/cribbage/cards.c
===================================================================
RCS file: /home/dcvs/src/games/cribbage/cards.c,v
retrieving revision 1.2
diff -u -r1.2 cards.c
--- games/cribbage/cards.c	17 Jun 2003 04:25:23 -0000	1.2
+++ games/cribbage/cards.c	1 Aug 2005 11:11:53 -0000
@@ -35,21 +35,16 @@
  * $DragonFly: src/games/cribbage/cards.c,v 1.2 2003/06/17 04:25:23 dillon Exp $
  */
 
-#include <curses.h>
-#include <stdio.h>
 #include <stdlib.h>
-#include <time.h>
 
-#include "deck.h"
 #include "cribbage.h"
 
-
+static bool	eq(CARD, CARD);
 /*
  * Initialize a deck of cards to contain one of each type.
  */
 void
-makedeck(d)
-	CARD    d[];
+makedeck(CARD d[])
 {
 	int i, j, k;
 
@@ -67,8 +62,7 @@
  * see Knuth, vol. 2, page 125.
  */
 void
-shuffle(d)
-	CARD d[];
+shuffle(CARD d[])
 {
 	int j, k;
 	CARD c;
@@ -84,9 +78,8 @@
 /*
  * return true if the two cards are equal...
  */
-int
-eq(a, b)
-	CARD a, b;
+static bool
+eq(CARD a, CARD b)
 {
 	return ((a.rank == b.rank) && (a.suit == b.suit));
 }
@@ -94,26 +87,22 @@
 /*
  * isone returns TRUE if a is in the set of cards b
  */
-int
-isone(a, b, n)
-	CARD a, b[];
-	int n;
+bool
+isone(CARD a, CARD b[], int n)
 {
 	int i;
 
 	for (i = 0; i < n; i++)
 		if (eq(a, b[i]))
-			return (TRUE);
-	return (FALSE);
+			return (true);
+	return (false);
 }
 
 /*
  * remove the card a from the deck d of n cards
  */
 void
-cremove(a, d, n)
-	CARD a, d[];
-	int n;
+cremove(CARD a, CARD d[], int n)
 {
 	int i, j;
 
@@ -129,9 +118,7 @@
  *	Sort a hand of n cards
  */
 void
-sorthand(h, n)
-	CARD h[];
-	int n;
+sorthand(CARD h[], int n)
 {
 	CARD *cp, *endp;
 	CARD c;
Index: games/cribbage/crib.c
===================================================================
RCS file: /home/dcvs/src/games/cribbage/crib.c,v
retrieving revision 1.2
diff -u -r1.2 crib.c
--- games/cribbage/crib.c	17 Jun 2003 04:25:23 -0000	1.2
+++ games/cribbage/crib.c	1 Aug 2005 11:12:14 -0000
@@ -36,24 +36,31 @@
  * $DragonFly: src/games/cribbage/crib.c,v 1.2 2003/06/17 04:25:23 dillon Exp $
  */
 
-#include <curses.h>
 #include <signal.h>
 #include <stdlib.h>
-#include <string.h>
 #include <unistd.h>
 #include <stdio.h>
 
-#include "deck.h"
 #include "cribbage.h"
 #include "cribcur.h"
 #include "pathnames.h"
 
+static bool	cut(bool, int);
+static int	deal(bool);
+static void	discard(bool);
+static void	game(void);
+static void	gamescore(void);
+static void	makeboard(void);
+static bool	peg(bool);
+static bool	playhand(bool);
+static void	prcrib(bool, bool);
+static void	prtable(int);
+static bool	scoreh(bool);
+
 int
-main(argc, argv)
-	int argc;
-	char *argv[];
+main(int argc, char *argv[])
 {
-	BOOLEAN playing;
+	bool playing;
 	FILE *f;
 	int ch;
 
@@ -65,22 +72,22 @@
 	while ((ch = getopt(argc, argv, "eqr")) != -1)
 		switch (ch) {
 		case 'e':
-			explain = TRUE;
+			explain = true;
 			break;
 		case 'q':
-			quiet = TRUE;
+			quiet = true;
 			break;
 		case 'r':
-			rflag = TRUE;
+			rflag = true;
 			break;
 		case '?':
 		default:
-			(void) fprintf(stderr, "usage: cribbage [-eqr]\n");
+			fprintf(stderr, "usage: cribbage [-eqr]\n");
 			exit(1);
 		}
 
 	initscr();
-	(void)signal(SIGINT, rint);
+	signal(SIGINT, intr);
 	crmode();
 	noecho();
 
@@ -108,7 +115,7 @@
 			msg("For cribbage rules, use \"man cribbage\"");
 		}
 	}
-	playing = TRUE;
+	playing = true;
 	do {
 		wclrtobot(Msgwin);
 		msg(quiet ? "L or S? " : "Long (to 121) or Short (to 61)? ");
@@ -122,25 +129,24 @@
 	} while (playing);
 
 	if (f != NULL) {
-		(void)fprintf(f, "%s: won %5.5d, lost %5.5d\n",
+		fprintf(f, "%s: won %5.5d, lost %5.5d\n",
 		    getlogin(), cgames, pgames);
-		(void) fclose(f);
+		fclose(f);
 	}
 	bye();
 	if (!f) {
-		(void) fprintf(stderr, "\ncribbage: can't open %s.\n",
-		    _PATH_LOG);
+		fprintf(stderr, "\ncribbage: can't open %s.\n", _PATH_LOG);
 		exit(1);
 	}
-	exit(0);
+	return(0);
 }
 
 /*
  * makeboard:
  *	Print out the initial board on the screen
  */
-void
-makeboard()
+static void
+makeboard(void)
 {
 	mvaddstr(SCORE_Y + 0, SCORE_X,
 	    "+---------------------------------------+");
@@ -167,8 +173,8 @@
  * gamescore:
  *	Print out the current game score
  */
-void
-gamescore()
+static void
+gamescore(void)
 {
 
 	if (pgames || cgames) {
@@ -184,18 +190,17 @@
  *	Play one game up to glimit points.  Actually, we only ASK the
  *	player what card to turn.  We do a random one, anyway.
  */
-void
-game()
+static void
+game(void)
 {
 	int i, j;
-	BOOLEAN flag;
-	BOOLEAN compcrib;
+	bool flag, compcrib;
 
-	compcrib = FALSE;
+	compcrib = false;
 	makedeck(deck);
 	shuffle(deck);
 	if (gamecount == 0) {
-		flag = TRUE;
+		flag = true;
 		do {
 			if (!rflag) {			/* player cuts deck */
 				msg(quiet ? "Cut for crib? " :
@@ -207,10 +212,10 @@
 				j = random() % CARDS;
 			} while (j == i);
 			addmsg(quiet ? "You cut " : "You cut the ");
-			msgcard(deck[i], FALSE);
+			msgcard(deck[i], false);
 			endmsg();
 			addmsg(quiet ? "I cut " : "I cut the ");
-			msgcard(deck[j], FALSE);
+			msgcard(deck[j], false);
 			endmsg();
 			flag = (deck[i].rank == deck[j].rank);
 			if (flag) {
@@ -234,7 +239,7 @@
 	}
 
 	pscore = cscore = 0;
-	flag = TRUE;
+	flag = true;
 	do {
 		shuffle(deck);
 		flag = !playhand(compcrib);
@@ -253,7 +258,7 @@
 				msg("YOU WON!");
 				++pgames;
 			}
-		iwon = FALSE;
+		iwon = false;
 	} else {
 		if (glimit - pscore > 60) {
 			msg("I DOUBLE SKUNKED YOU!");
@@ -266,7 +271,7 @@
 				msg("I WON!");
 				++cgames;
 			}
-		iwon = TRUE;
+		iwon = true;
 	}
 	gamescore();
 }
@@ -275,9 +280,8 @@
  * playhand:
  *	Do up one hand of the game
  */
-int
-playhand(mycrib)
-	BOOLEAN mycrib;
+static bool
+playhand(bool mycrib)
 {
 	int deckpos;
 
@@ -288,25 +292,24 @@
 	sorthand(chand, FULLHAND);
 	sorthand(phand, FULLHAND);
 	makeknown(chand, FULLHAND);
-	prhand(phand, FULLHAND, Playwin, FALSE);
+	prhand(phand, FULLHAND, Playwin, false);
 	discard(mycrib);
 	if (cut(mycrib, deckpos))
-		return TRUE;
+		return true;
 	if (peg(mycrib))
-		return TRUE;
+		return true;
 	werase(Tablewin);
 	wrefresh(Tablewin);
-	if (score(mycrib))
-		return TRUE;
-	return FALSE;
+	if (scoreh(mycrib))
+		return true;
+	return false;
 }
 
 /*
  * deal cards to both players from deck
  */
-int
-deal(mycrib)
-	BOOLEAN mycrib;
+static int
+deal(bool mycrib)
 {
 	int i, j;
 
@@ -325,27 +328,26 @@
 /*
  * discard:
  *	Handle players discarding into the crib...
- * Note: we call cdiscard() after prining first message so player doesn't wait
+ * Note: we call cdiscard() after printing first message so player doesn't wait
  */
-void
-discard(mycrib)
-	BOOLEAN mycrib;
+static void
+discard(bool mycrib)
 {
-	char *prompt;
+	const char *prompt;
 	CARD crd;
 
-	prcrib(mycrib, TRUE);
+	prcrib(mycrib, true);
 	prompt = (quiet ? "Discard --> " : "Discard a card --> ");
 	cdiscard(mycrib);	/* puts best discard at end */
 	crd = phand[infrom(phand, FULLHAND, prompt)];
 	cremove(crd, phand, FULLHAND);
-	prhand(phand, FULLHAND, Playwin, FALSE);
+	prhand(phand, FULLHAND, Playwin, false);
 	crib[0] = crd;
 
 	/* Next four lines same as last four except for cdiscard(). */
 	crd = phand[infrom(phand, FULLHAND - 1, prompt)];
 	cremove(crd, phand, FULLHAND - 1);
-	prhand(phand, FULLHAND, Playwin, FALSE);
+	prhand(phand, FULLHAND, Playwin, false);
 	crib[1] = crd;
 	crib[2] = chand[4];
 	crib[3] = chand[5];
@@ -357,15 +359,13 @@
  *	Cut the deck and set turnover.  Actually, we only ASK the
  *	player what card to turn.  We do a random one, anyway.
  */
-int
-cut(mycrib, pos)
-	BOOLEAN mycrib;
-	int  pos;
+static bool
+cut(bool mycrib, int pos)
 {
 	int i;
-	BOOLEAN win;
+	bool win;
 
-	win = FALSE;
+	win = false;
 	if (mycrib) {
 		if (!rflag) {	/* random cut */
 			msg(quiet ? "Cut the deck? " :
@@ -375,7 +375,7 @@
 		i = random() % (CARDS - pos);
 		turnover = deck[i + pos];
 		addmsg(quiet ? "You cut " : "You cut the ");
-		msgcard(turnover, FALSE);
+		msgcard(turnover, false);
 		endmsg();
 		if (turnover.rank == JACK) {
 			msg("I get two for his heels");
@@ -385,7 +385,7 @@
 		i = random() % (CARDS - pos) + pos;
 		turnover = deck[i];
 		addmsg(quiet ? "I cut " : "I cut the ");
-		msgcard(turnover, FALSE);
+		msgcard(turnover, false);
 		endmsg();
 		if (turnover.rank == JACK) {
 			msg("You get two for his heels");
@@ -393,7 +393,7 @@
 		}
 	}
 	makeknown(&turnover, 1);
-	prcrib(mycrib, FALSE);
+	prcrib(mycrib, false);
 	return (win);
 }
 
@@ -401,9 +401,8 @@
  * prcrib:
  *	Print out the turnover card with crib indicator
  */
-void
-prcrib(mycrib, blank)
-	BOOLEAN mycrib, blank;
+static void
+prcrib(bool mycrib, bool blank)
 {
 	int y, cardx;
 
@@ -431,15 +430,14 @@
 static CARD Table[14];
 static int Tcnt;
 
-int
-peg(mycrib)
-	BOOLEAN mycrib;
+static bool
+peg(bool mycrib)
 {
 	static CARD ch[CINHAND], ph[CINHAND];
 	int i, j, k;
 	int l;
 	int cnum, pnum, sum;
-	BOOLEAN myturn, mego, ugo, last, played;
+	bool myturn, mego, ugo, last, played;
 	CARD crd;
 
 	cnum = pnum = CINHAND;
@@ -449,18 +447,18 @@
 	}
 	Tcnt = 0;		/* index to table of cards played */
 	sum = 0;		/* sum of cards played */
-	played = mego = ugo = FALSE;
+	played = mego = ugo = false;
 	myturn = !mycrib;
 	for (;;) {
-		last = TRUE;	/* enable last flag */
-		prhand(ph, pnum, Playwin, FALSE);
-		prhand(ch, cnum, Compwin, TRUE);
+		last = true;	/* enable last flag */
+		prhand(ph, pnum, Playwin, false);
+		prhand(ch, cnum, Compwin, true);
 		prtable(sum);
 		if (myturn) {	/* my tyrn to play */
 			if (!anymove(ch, cnum, sum)) {	/* if no card to play */
 				if (!mego && cnum) {	/* go for comp? */
 					msg("GO");
-					mego = TRUE;
+					mego = true;
 				}
 							/* can player move? */
 				if (anymove(ph, pnum, sum))
@@ -469,13 +467,13 @@
 					msg(quiet ? "You get one" :
 					    "You get one point");
 					if (chkscr(&pscore, 1))
-						return TRUE;
+						return (true);
 					sum = 0;
-					mego = ugo = FALSE;
+					mego = ugo = false;
 					Tcnt = 0;
 				}
 			} else {
-				played = TRUE;
+				played = true;
 				j = -1;
 				k = 0;
 							/* maximize score */
@@ -495,10 +493,10 @@
 				if (k > 0) {
 					addmsg(quiet ? "I get %d playing " :
 					    "I get %d points playing ", k);
-					msgcard(crd, FALSE);
+					msgcard(crd, false);
 					endmsg();
 					if (chkscr(&cscore, k))
-						return TRUE;
+						return (true);
 				}
 				myturn = !myturn;
 			}
@@ -506,7 +504,7 @@
 			if (!anymove(ph, pnum, sum)) {	/* can player move? */
 				if (!ugo && pnum) {	/* go for player */
 					msg("You have a GO");
-					ugo = TRUE;
+					ugo = true;
 				}
 							/* can computer play? */
 				if (anymove(ch, cnum, sum))
@@ -516,20 +514,20 @@
 					    "I get one point");
 					do_wait();
 					if (chkscr(&cscore, 1))
-						return TRUE;
+						return (true);
 					sum = 0;
-					mego = ugo = FALSE;
+					mego = ugo = false;
 					Tcnt = 0;
 				}
 			} else {			/* player plays */
-				played = FALSE;
+				played = false;
 				if (pnum == 1) {
 					crd = ph[0];
 					msg("You play your last card");
 				} else
 					for (;;) {
 						prhand(ph,
-						    pnum, Playwin, FALSE);
+						    pnum, Playwin, false);
 						crd = ph[infrom(ph,
 						    pnum, "Your play: ")];
 						if (sum + VAL(crd.rank) <= 31)
@@ -546,7 +544,7 @@
 					msg(quiet ? "You got %d" :
 					    "You got %d points", i);
 					if (chkscr(&pscore, i))
-						return TRUE;
+						return (true);
 				}
 				myturn = !myturn;
 			}
@@ -555,15 +553,15 @@
 			if (!myturn)
 				do_wait();
 			sum = 0;
-			mego = ugo = FALSE;
+			mego = ugo = false;
 			Tcnt = 0;
-			last = FALSE;			/* disable last flag */
+			last = false;			/* disable last flag */
 		}
 		if (!pnum && !cnum)
 			break;				/* both done */
 	}
-	prhand(ph, pnum, Playwin, FALSE);
-	prhand(ch, cnum, Compwin, TRUE);
+	prhand(ph, pnum, Playwin, false);
+	prhand(ch, cnum, Compwin, true);
 	prtable(sum);
 	if (last) {
 		if (played) {
@@ -571,54 +569,52 @@
 			    "I get one point for last");
 			do_wait();
 			if (chkscr(&cscore, 1))
-				return TRUE;
+				return (true);
 		} else {
 			msg(quiet ? "You get one for last" :
 			    "You get one point for last");
 			if (chkscr(&pscore, 1))
-				return TRUE;
+				return (true);
 		}
 	}
-	return (FALSE);
+	return (false);
 }
 
 /*
  * prtable:
  *	Print out the table with the current score
  */
-void
-prtable(score)
-	int score;
+static void
+prtable(int score)
 {
-	prhand(Table, Tcnt, Tablewin, FALSE);
+	prhand(Table, Tcnt, Tablewin, false);
 	mvwprintw(Tablewin, (Tcnt + 2) * 2, Tcnt + 1, "%2d", score);
 	wrefresh(Tablewin);
 }
 
 /*
- * score:
+ * scoreh:
  *	Handle the scoring of the hands
  */
-int
-score(mycrib)
-	BOOLEAN mycrib;
+static bool
+scoreh(bool mycrib)
 {
 	sorthand(crib, CINHAND);
 	if (mycrib) {
 		if (plyrhand(phand, "hand"))
-			return (TRUE);
+			return (true);
 		if (comphand(chand, "hand"))
-			return (TRUE);
+			return (true);
 		do_wait();
 		if (comphand(crib, "crib"))
-			return (TRUE);
+			return (true);
 	} else {
 		if (comphand(chand, "hand"))
-			return (TRUE);
+			return (true);
 		if (plyrhand(phand, "hand"))
-			return (TRUE);
+			return (true);
 		if (plyrhand(crib, "crib"))
-			return (TRUE);
+			return (true);
 	}
-	return (FALSE);
+	return (false);
 }
Index: games/cribbage/cribbage.h
===================================================================
RCS file: /home/dcvs/src/games/cribbage/cribbage.h,v
retrieving revision 1.2
diff -u -r1.2 cribbage.h
--- games/cribbage/cribbage.h	12 Nov 2003 14:53:52 -0000	1.2
+++ games/cribbage/cribbage.h	1 Aug 2005 13:12:36 -0000
@@ -34,6 +34,10 @@
  * $DragonFly: src/games/cribbage/cribbage.h,v 1.2 2003/11/12 14:53:52 eirikn Exp $
  */
 
+#include	<curses.h>
+
+#include	"deck.h"
+
 extern  CARD		deck[ CARDS ];		/* a deck */
 extern  CARD		phand[ FULLHAND ];	/* player's hand */
 extern  CARD		chand[ FULLHAND ];	/* computer's hand */
@@ -52,62 +56,39 @@
 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  bool		iwon;			/* if comp won last */
+extern  bool		explain;		/* player mistakes explained */
+extern  bool		rflag;			/* if all cuts random */
+extern  bool		quiet;			/* if suppress random mess */
 
-extern  char		expl[];			/* string for explanation */
+extern  char		explstr[];		/* string for explanation */
 
 void	 addmsg (const char *, ...);
-int	 adjust (CARD [], CARD);
-int	 anymove (CARD [], int, int);
-int	 anysumto (CARD [], int, int, int);
+int	 adjust (CARD []);
+bool	 anymove (CARD [], int, int);
 void	 bye (void);
 int	 cchose (CARD [], int, int);
-void	 cdiscard (BOOLEAN);
-int	 chkscr (int *, int);
-int	 comphand (CARD [], char *);
+void	 cdiscard (bool);
+bool	 chkscr (int *, int);
+bool	 comphand (CARD [], const char *);
 void	 cremove (CARD, CARD [], int);
-int	 cut (BOOLEAN, int);
-int	 deal (int);
-void	 discard (BOOLEAN);
 void	 do_wait (void);
 void	 endmsg (void);
-int	 eq (CARD, CARD);
-int	 fifteens (CARD [], int);
-void	 game (void);
-void	 gamescore (void);
 char	*getline (void);
 int	 getuchar (void);
-int	 incard (CARD *);
-int	 infrom (CARD [], int, char *);
+int	 infrom (CARD [], int, const char *);
 void	 instructions (void);
-int	 isone (CARD, CARD [], int);
-void	 makeboard (void);
+void     intr (int);
+bool	 isone (CARD, CARD [], int);
 void	 makedeck (CARD []);
 void	 makeknown (CARD [], int);
 void	 msg (const char *, ...);
-int	 msgcard (CARD, BOOLEAN);
-int	 msgcrd (CARD, BOOLEAN, char *, BOOLEAN);
-int	 number (int, int, char *);
-int	 numofval (CARD [], int, int);
-int	 pairuns (CARD [], int);
-int	 peg (BOOLEAN);
+bool	 msgcard (CARD, bool);
+int	 number (int, int, const char *);
 int	 pegscore (CARD, CARD [], int, int);
-int	 playhand (BOOLEAN);
-int	 plyrhand (CARD [], char *);
-void	 prcard (WINDOW *, int, int, CARD, BOOLEAN);
-void	 prcrib (BOOLEAN, BOOLEAN);
-void	 prhand (CARD [], int, WINDOW *, BOOLEAN);
-void	 printcard (WINDOW *, int, CARD, BOOLEAN);
-void	 prpeg (int, int, BOOLEAN);
-void	 prtable (int);
-int	 readchar (void);
-void	 rint (int);
-int	 score (BOOLEAN);
-int	 scorehand (CARD [], CARD, int, BOOLEAN, BOOLEAN);
+bool	 plyrhand (CARD [], const char *);
+void	 prcard (WINDOW *, int, int, CARD, bool);
+void	 prhand (CARD [], int, WINDOW *, bool);
+int	 scorehand (CARD [], CARD, int, bool, bool);
 void	 shuffle (CARD []);
 void	 sorthand (CARD [], int);
-void	 wait_for (int);
Index: games/cribbage/cribcur.h
===================================================================
RCS file: /home/dcvs/src/games/cribbage/cribcur.h,v
retrieving revision 1.1
diff -u -r1.1 cribcur.h
--- games/cribbage/cribcur.h	17 Jun 2003 02:49:22 -0000	1.1
+++ games/cribbage/cribcur.h	1 Aug 2005 11:05:49 -0000
@@ -33,6 +33,8 @@
  *	@(#)cribcur.h	8.1 (Berkeley) 5/31/93
  */
 
+#include	<curses.h>
+
 # define	PLAY_Y		15	/* size of player's hand window */
 # define	PLAY_X		12
 # define	TABLE_Y		21	/* size of table window */
Index: games/cribbage/deck.h
===================================================================
RCS file: /home/dcvs/src/games/cribbage/deck.h,v
retrieving revision 1.1
diff -u -r1.1 deck.h
--- games/cribbage/deck.h	17 Jun 2003 02:49:22 -0000	1.1
+++ games/cribbage/deck.h	1 Aug 2005 11:07:25 -0000
@@ -71,15 +71,7 @@
 #define		VAL(c)		( (c) < 9 ? (c)+1 : 10 )    /* val of rank */
 
 
-#ifndef TRUE
-#	define		TRUE		1
-#	define		FALSE		0
-#endif
-
 typedef		struct  {
 			int		rank;
 			int		suit;
 		}		CARD;
-
-typedef		char		BOOLEAN;
-
Index: games/cribbage/extern.c
===================================================================
RCS file: /home/dcvs/src/games/cribbage/extern.c,v
retrieving revision 1.3
diff -u -r1.3 extern.c
--- games/cribbage/extern.c	2 Mar 2005 16:14:03 -0000	1.3
+++ games/cribbage/extern.c	1 Aug 2005 11:14:15 -0000
@@ -35,17 +35,14 @@
  * $DragonFly: src/games/cribbage/extern.c,v 1.3 2005/03/02 16:14:03 eirikn Exp $
  */
 
-#include <curses.h>
-
-#include "deck.h"
 #include "cribbage.h"
 
-BOOLEAN	explain		= FALSE;	/* player mistakes explained */
-BOOLEAN	iwon		= FALSE;	/* if comp won last game */
-BOOLEAN	quiet		= FALSE;	/* if suppress random mess */
-BOOLEAN	rflag		= FALSE;	/* if all cuts random */
+bool	explain		= false;	/* player mistakes explained */
+bool	iwon		= false;	/* if comp won last game */
+bool	quiet		= false;	/* if suppress random mess */
+bool	rflag		= false;	/* if all cuts random */
 
-char	expl[128];			/* explanation */
+char	explstr[128];			/* explanation */
 
 int	cgames		= 0;		/* number games comp won */
 int	cscore		= 0;		/* comp score in this game */
Index: games/cribbage/instr.c
===================================================================
RCS file: /home/dcvs/src/games/cribbage/instr.c,v
retrieving revision 1.2
diff -u -r1.2 instr.c
--- games/cribbage/instr.c	17 Jun 2003 04:25:23 -0000	1.2
+++ games/cribbage/instr.c	1 Aug 2005 11:45:34 -0000
@@ -35,37 +35,34 @@
  * $DragonFly: src/games/cribbage/instr.c,v 1.2 2003/06/17 04:25:23 dillon Exp $
  */
 
-#include <sys/types.h>
 #include <sys/wait.h>
-#include <sys/errno.h>
 #include <sys/stat.h>
 
-#include <curses.h>
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
-#include "deck.h"
 #include "cribbage.h"
 #include "pathnames.h"
 
 void
-instructions()
+instructions(void)
 {
 	struct stat sb;
 	union wait pstat;
 	pid_t pid;
-	char *pager, *path;
+	const char *pager, *path;
 
 	if (stat(_PATH_INSTR, &sb)) {
-		(void)fprintf(stderr, "cribbage: %s: %s.\n", _PATH_INSTR,
+		fprintf(stderr, "cribbage: %s: %s.\n", _PATH_INSTR,
 		    strerror(errno));
 		exit(1);
 	}
 	switch (pid = vfork()) {
 	case -1:
-		(void)fprintf(stderr, "cribbage: %s.\n", strerror(errno));
+		fprintf(stderr, "cribbage: %s.\n", strerror(errno));
 		exit(1);
 	case 0:
 		if (!(path = getenv("PAGER")))
@@ -73,8 +70,8 @@
 		if ((pager = rindex(path, '/')) != NULL)
 			++pager;
 		pager = path;
-		execlp(path, pager, _PATH_INSTR, (char *)NULL);
-		(void)fprintf(stderr, "cribbage: %s.\n", strerror(errno));
+		execlp(path, pager, _PATH_INSTR, NULL);
+		fprintf(stderr, "cribbage: %s.\n", strerror(errno));
 		_exit(1);
 	default:
 		do {
Index: games/cribbage/io.c
===================================================================
RCS file: /home/dcvs/src/games/cribbage/io.c,v
retrieving revision 1.3
diff -u -r1.3 io.c
--- games/cribbage/io.c	27 Jul 2004 07:37:39 -0000	1.3
+++ games/cribbage/io.c	1 Aug 2005 12:38:52 -0000
@@ -36,16 +36,12 @@
  */
 
 #include <ctype.h>
-#include <curses.h>
 #include <signal.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <termios.h>
 #include <unistd.h>
 
-#include <stdarg.h>
-
-#include "deck.h"
 #include "cribbage.h"
 #include "cribcur.h"
 
@@ -58,46 +54,47 @@
 
 char    linebuf[LINESIZE];
-char   *rankname[RANKS] = {
+const char *const rankname[RANKS] = {
 	"ACE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN",
 	"EIGHT", "NINE", "TEN", "JACK", "QUEEN", "KING"
 };
 
-char   *rankchar[RANKS] = {
+const char *const rankchar[RANKS] = {
 	"A", "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K"
 };
 
-char   *suitname[SUITS] = {"SPADES", "HEARTS", "DIAMONDS", "CLUBS"};
+const char *const suitname[SUITS] = {"SPADES", "HEARTS", "DIAMONDS", "CLUBS"};
+
+const char *const suitchar[SUITS] = {"S", "H", "D", "C"};
 
-char   *suitchar[SUITS] = {"S", "H", "D", "C"};
+static bool	incard(CARD *);
+static bool	msgcrd(CARD, bool, const char *, bool);
+static void	printcard(WINDOW *, int, CARD, bool);
+static int	readchar(void);
+static void	wait_for(int);
 
 /*
  * msgcard:
  *	Call msgcrd in one of two forms
  */
-int
-msgcard(c, brief)
-	CARD c;
-	BOOLEAN brief;
+bool
+msgcard(CARD c, bool brief)
 {
 	if (brief)
-		return (msgcrd(c, TRUE, NULL, TRUE));
+		return (msgcrd(c, true, NULL, true));
 	else
-		return (msgcrd(c, FALSE, " of ", FALSE));
+		return (msgcrd(c, false, " of ", false));
 }
 
 /*
  * msgcrd:
  *	Print the value of a card in ascii
  */
-int
-msgcrd(c, brfrank, mid, brfsuit)
-	CARD c;
-	BOOLEAN brfrank, brfsuit;
-	char *mid;
+static bool
+msgcrd(CARD c, bool brfrank, const char *mid, bool brfsuit)
 {
 	if (c.rank == EMPTY || c.suit == EMPTY)
-		return (FALSE);
+		return (false);
 	if (brfrank)
 		addmsg("%1.1s", rankchar[c.rank]);
 	else
@@ -108,19 +105,15 @@
 		addmsg("%1.1s", suitchar[c.suit]);
 	else
 		addmsg("%s", suitname[c.suit]);
-	return (TRUE);
+	return (true);
 }
 
 /*
  * printcard:
  *	Print out a card.
  */
-void
-printcard(win, cardno, c, blank)
-	WINDOW *win;
-	int     cardno;
-	CARD    c;
-	BOOLEAN blank;
+static void
+printcard(WINDOW *win, int cardno, CARD c, bool blank)
 {
 	prcard(win, cardno * 2, cardno, c, blank);
 }
@@ -130,11 +123,7 @@
  *	Print out a card on the window at the specified location
  */
 void
-prcard(win, y, x, c, blank)
-	WINDOW *win;
-	int y, x;
-	CARD c;
-	BOOLEAN blank;
+prcard(WINDOW *win, int y, int x, CARD c, bool blank)
 {
 	if (c.rank == EMPTY)
 		return;
@@ -157,11 +146,7 @@
  *	Print a hand of n cards
  */
 void
-prhand(h, n, win, blank)
-	CARD h[];
-	int n;
-	WINDOW *win;
-	BOOLEAN blank;
+prhand(CARD h[], int n, WINDOW *win, bool blank)
 {
 	int i;
 
@@ -173,14 +158,11 @@
 
 /*
  * infrom:
- *	reads a card, supposedly in hand, accepting unambigous brief
+ *	reads a card, supposedly in hand, accepting unambiguous brief
  *	input, returns the index of the card found...
  */
 int
-infrom(hand, n, prompt)
-	CARD hand[];
-	int n;
-	char *prompt;
+infrom(CARD hand[], int n, const char *prompt)
 {
 	int i, j;
 	CARD crd;
@@ -232,16 +214,15 @@
  *	Inputs a card in any format.  It reads a line ending with a CR
  *	and then parses it.
  */
-int
-incard(crd)
-	CARD *crd;
+static bool
+incard(CARD *crd)
 {
 	int i;
 	int rnk, sut;
 	char *line, *p, *p1;
-	BOOLEAN retval;
+	bool retval;
 
-	retval = FALSE;
+	retval = false;
 	rnk = sut = EMPTY;
 	if (!(line = getline()))
 		goto gotit;
@@ -272,7 +253,7 @@
 			}
 		}
 		if (sut != EMPTY)
-			retval = TRUE;
+			retval = true;
 		goto gotit;
 	}
 	rnk = EMPTY;
@@ -306,7 +287,7 @@
 		}
 	}
 	if (sut != EMPTY)
-		retval = TRUE;
+		retval = true;
 gotit:
 	(*crd).rank = rnk;
 	(*crd).suit = sut;
@@ -318,7 +299,7 @@
  *	Reads and converts to upper case
  */
 int
-getuchar()
+getuchar(void)
 {
 	int c;
 
@@ -335,9 +316,7 @@
  *	"hi" inclusive.
  */
 int
-number(lo, hi, prompt)
-	int lo, hi;
-	char *prompt;
+number(int lo, int hi, const char *prompt)
 {
 	char *p;
 	int sum;
@@ -386,7 +365,7 @@
 	va_list ap;
 
 	va_start(ap, fmt);
-	(void)vsprintf(&Msgbuf[Newpos], fmt, ap);
+	vsprintf(&Msgbuf[Newpos], fmt, ap);
 	va_end(ap);
 	endmsg();
 }
@@ -401,7 +380,7 @@
 	va_list ap;
 
 	va_start(ap, fmt);
-	(void)vsprintf(&Msgbuf[Newpos], fmt, ap);
+	vsprintf(&Msgbuf[Newpos], fmt, ap);
 	va_end(ap);
 }
 
@@ -412,7 +391,7 @@
 int     Lineno = 0;
 
 void
-endmsg()
+endmsg(void)
 {
 	static int lastline = 0;
 	int len;
@@ -461,11 +440,11 @@
  *	Wait for the user to type ' ' before doing anything else
  */
 void
-do_wait()
+do_wait(void)
 {
 	static char prompt[] = {'-', '-', 'M', 'o', 'r', 'e', '-', '-', '\0'};
 
-	if (Mpos + sizeof prompt < MSG_X)
+	if (Mpos + (int)sizeof(prompt) < MSG_X)
 		wmove(Msgwin, Lineno > 0 ? Lineno - 1 : MSG_Y - 1, Mpos);
 	else {
 		mvwaddch(Msgwin, Lineno, 0, ' ');
@@ -482,9 +461,8 @@
  * wait_for
  *	Sit around until the guy types the right key
  */
-void
-wait_for(ch)
-	int ch;
+static void
+wait_for(int ch)
 {
 	char c;
 
@@ -500,8 +478,8 @@
  * readchar:
  *	Reads and returns a character, checking for gross input errors
  */
-int
-readchar()
+static int
+readchar(void)
 {
 	int cnt;
 	char c;
@@ -529,7 +507,7 @@
  *	compressed to one space; a space is inserted before a ','
  */
 char *
-getline()
+getline(void)
 {
 	char *sp;
 	int c, oy, ox;
@@ -578,8 +556,7 @@
 }
 
 void
-rint(signo)
-	int signo;
+intr(__unused int signo)
 {
 	bye();
 	exit(1);
@@ -590,7 +567,7 @@
  *	Leave the program, cleaning things up as we go.
  */
 void
-bye()
+bye(void)
 {
 	signal(SIGINT, SIG_IGN);
 	mvcur(0, COLS - 1, LINES - 1, 0);
Index: games/cribbage/score.c
===================================================================
RCS file: /home/dcvs/src/games/cribbage/score.c,v
retrieving revision 1.2
diff -u -r1.2 score.c
--- games/cribbage/score.c	17 Jun 2003 04:25:23 -0000	1.2
+++ games/cribbage/score.c	1 Aug 2005 12:55:59 -0000
@@ -35,21 +35,21 @@
  * $DragonFly: src/games/cribbage/score.c,v 1.2 2003/06/17 04:25:23 dillon Exp $
  */
 
-#include <curses.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "deck.h"
 #include "cribbage.h"
 
+static int	fifteens(CARD[], int);
+static int	pairuns(CARD[], int);
 /*
  * the following arrays give the sum of the scores of the (50 2)*48 = 58800
  * hands obtainable for the crib given the two cards whose ranks index the
  * array.  the two arrays are for the case where the suits are equal and
  * not equal respectively
  */
-long crbescr[169] = {
+const long crbescr[169] = {
     -10000, 271827, 278883, 332319, 347769, 261129, 250653, 253203, 248259,
     243435, 256275, 237435, 231051, -10000, -10000, 412815, 295707, 349497,
     267519, 262521, 259695, 254019, 250047, 262887, 244047, 237663, -10000,
@@ -71,7 +71,7 @@
     -10000, -10000, -10000, -10000, -10000, -10000, -10000
 };
 
-long crbnescr[169] = {
+const long crbnescr[169] = {
     325272, 260772, 267828, 321264, 336714, 250074, 239598, 242148, 237204,
     232380, 246348, 226380, 219996, -10000, 342528, 401760, 284652, 338442,
     256464, 251466, 248640, 242964, 238992, 252960, 232992, 226608, -10000,
@@ -93,31 +93,28 @@
     -10000, -10000, -10000, -10000, -10000, -10000, 295896
 };
 
-static int ichoose2[5] = { 0, 0, 2, 6, 12 };
+static const int ichoose2[5] = { 0, 0, 2, 6, 12 };
 static int pairpoints, runpoints;		/* Globals from pairuns. */
 
 /*
  * scorehand:
  *	Score the given hand of n cards and the starter card.
  *	n must be <= 4
+ *	crb is true if scoring crib
+ *	do_explain is true if must explain this hand
  */
 int
-scorehand(hand, starter, n, crb, do_explain)
-	CARD hand[];
-	CARD starter;
-	int n;
-	BOOLEAN crb;		/* true if scoring crib */
-	BOOLEAN do_explain;	/* true if must explain this hand */
+scorehand(CARD hand[], CARD starter, int n, bool crb, bool do_explain)
 {
 	int i, k;
 	int score;
-	BOOLEAN flag;
+	bool flag;
 	CARD h[(CINHAND + 1)];
 	char buf[32];
 
-	expl[0] = '\0';		/* initialize explanation */
+	explstr[0] = '\0';		/* initialize explanation */
 	score = 0;
-	flag = TRUE;
+	flag = true;
 	k = hand[0].suit;
 	for (i = 0; i < n; i++) {	/* check for flush */
 		flag = (flag && (hand[i].suit == k));
@@ -125,49 +122,49 @@
 			if (hand[i].suit == starter.suit) {
 				score++;
 				if (do_explain)
-					strcat(expl, "His Nobs");
+					strcat(explstr, "His Nobs");
 			}
 		h[i] = hand[i];
 	}
 
 	if (flag && n >= CINHAND) {
-		if (do_explain && expl[0] != '\0')
-			strcat(expl, ", ");
+		if (do_explain && explstr[0] != '\0')
+			strcat(explstr, ", ");
 		if (starter.suit == k) {
 			score += 5;
 			if (do_explain)
-				strcat(expl, "Five-flush");
+				strcat(explstr, "Five-flush");
 		} else
 			if (!crb) {
 				score += 4;
-				if (do_explain && expl[0] != '\0')
-					strcat(expl, ", Four-flush");
+				if (do_explain && explstr[0] != '\0')
+					strcat(explstr, ", Four-flush");
 				else
-					strcpy(expl, "Four-flush");
+					strcpy(explstr, "Four-flush");
 			}
 	}
-	if (do_explain && expl[0] != '\0')
-		strcat(expl, ", ");
+	if (do_explain && explstr[0] != '\0')
+		strcat(explstr, ", ");
 	h[n] = starter;
 	sorthand(h, n + 1);	/* sort by rank */
 	i = 2 * fifteens(h, n + 1);
 	score += i;
 	if (do_explain) {
 		if (i > 0) {
-			(void) sprintf(buf, "%d points in fifteens", i);
-			strcat(expl, buf);
+			sprintf(buf, "%d points in fifteens", i);
+			strcat(explstr, buf);
 		} else
-			strcat(expl, "No fifteens");
+			strcat(explstr, "No fifteens");
 	}
 	i = pairuns(h, n + 1);
 	score += i;
 	if (do_explain) {
 		if (i > 0) {
-			(void) sprintf(buf, ", %d points in pairs, %d in runs",
+			sprintf(buf, ", %d points in pairs, %d in runs",
 			    pairpoints, runpoints);
-			strcat(expl, buf);
+			strcat(explstr, buf);
 		} else
-			strcat(expl, ", No pairs/runs");
+			strcat(explstr, ", No pairs/runs");
 	}
 	return (score);
 }
@@ -176,10 +173,8 @@
  * fifteens:
  *	Return number of fifteens in hand of n cards
  */
-int
-fifteens(hand, n)
-	CARD hand[];
-	int n;
+static int
+fifteens(CARD hand[], int n)
 {
 	int *sp, *np;
 	int i;
@@ -219,17 +214,15 @@
  * this routine only works if n is strictly less than 6
  * sets the globals pairpoints and runpoints appropriately
  */
-int
-pairuns(h, n)
-	CARD h[];
-	int n;
+static int
+pairuns(CARD h[], int n)
 {
 	int i;
 	int runlength, runmult, lastmult, curmult;
 	int mult1, mult2, pair1, pair2;
-	BOOLEAN run;
+	bool run;
 
-	run = TRUE;
+	run = true;
 	runlength = 1;
 	mult1 = 1;
 	pair1 = -1;
@@ -265,7 +258,7 @@
 				} else {
 							/* only if old short */
 					if (runlength < 3) {
-						run = TRUE;
+						run = true;
 						runlength = 2;
 						runmult = 1;
 					}
@@ -275,7 +268,7 @@
 							/* if just ended */
 				if (run)
 					runmult *= lastmult;
-				run = FALSE;
+				run = false;
 			}
 		}
 	}
@@ -289,11 +282,9 @@
  * the n cards in tbl during pegging
  */
 int
-pegscore(crd, tbl, n, sum)
-	CARD crd, tbl[];
-	int n, sum;
+pegscore(CARD crd, CARD tbl[], int n, int sum)
 {
-	BOOLEAN got[RANKS];
+	bool got[RANKS];
 	int i, j, scr;
 	int k, lo, hi;
 
@@ -315,13 +306,13 @@
 		return (scr);
 	lo = hi = crd.rank;
 	for (i = 0; i < RANKS; i++)
-		got[i] = FALSE;
-	got[crd.rank] = TRUE;
+		got[i] = false;
+	got[crd.rank] = true;
 	k = -1;
 	for (i = n - 1; i >= 0; --i) {
 		if (got[tbl[i].rank])
 			break;
-		got[tbl[i].rank] = TRUE;
+		got[tbl[i].rank] = true;
 		if (tbl[i].rank < lo)
 			lo = tbl[i].rank;
 		if (tbl[i].rank > hi)
@@ -344,8 +335,7 @@
  * points such a crib will get.
  */
 int
-adjust(cb, tnv)
-	CARD cb[], tnv;
+adjust(CARD cb[])
 {
 	long scr;
 	int i, c0, c1;
Index: games/cribbage/support.c
===================================================================
RCS file: /home/dcvs/src/games/cribbage/support.c,v
retrieving revision 1.2
diff -u -r1.2 support.c
--- games/cribbage/support.c	17 Jun 2003 04:25:23 -0000	1.2
+++ games/cribbage/support.c	1 Aug 2005 13:13:02 -0000
@@ -35,26 +35,27 @@
  * $DragonFly: src/games/cribbage/support.c,v 1.2 2003/06/17 04:25:23 dillon Exp $
  */
 
-#include <curses.h>
+#include <stdio.h>
 #include <string.h>
 
-#include "deck.h"
 #include "cribbage.h"
 #include "cribcur.h"
 
+static int	anysumto(CARD[], int, int, int);
+static int	numofval(CARD[], int, int);
+static void	prpeg(int, int, bool);
+
 #define	NTV	10		/* number scores to test */
 
 /* score to test reachability of, and order to test them in */
-int tv[NTV] = {8, 7, 9, 6, 11, 12, 13, 14, 10, 5};
+const int tv[NTV] = {8, 7, 9, 6, 11, 12, 13, 14, 10, 5};
 
 /*
  * computer chooses what to play in pegging...
  * only called if no playable card will score points
  */
 int
-cchose(h, n, s)
-	CARD h[];
-	int n, s;
+cchose(CARD h[], int n, int s)
 {
 	int i, j, l;
 
@@ -120,17 +121,15 @@
  * plyrhand:
  *	Evaluate and score a player hand or crib
  */
-int
-plyrhand(hand, s)
-	CARD    hand[];
-	char   *s;
+bool
+plyrhand(CARD hand[], const char *s)
 {
 	static char prompt[BUFSIZ];
 	int i, j;
-	BOOLEAN win;
+	bool win;
 
-	prhand(hand, CINHAND, Playwin, FALSE);
-	(void) sprintf(prompt, "Your %s scores ", s);
+	prhand(hand, CINHAND, Playwin, false);
+	sprintf(prompt, "Your %s scores ", s);
 	i = scorehand(hand, turnover, CINHAND, strcmp(s, "crib") == 0, explain);
 	if ((j = number(0, 29, prompt)) == 19)
 		j = 0;
@@ -145,7 +144,7 @@
 			msg("You should have taken %d, not %d!", i, j);
 		}
 		if (explain)
-			msg("Explanation: %s", expl);
+			msg("Explanation: %s", explstr);
 		do_wait();
 	} else
 		win = chkscr(&pscore, i);
@@ -154,17 +153,15 @@
 
 /*
  * comphand:
- *	Handle scoring and displaying the computers hand
+ *	Handle scoring and displaying the computer's hand
  */
-int
-comphand(h, s)
-	CARD h[];
-	char *s;
+bool
+comphand(CARD h[], const char *s)
 {
 	int j;
 
-	j = scorehand(h, turnover, CINHAND, strcmp(s, "crib") == 0, FALSE);
-	prhand(h, CINHAND, Compwin, FALSE);
+	j = scorehand(h, turnover, CINHAND, strcmp(s, "crib") == 0, false);
+	prhand(h, CINHAND, Compwin, false);
 	msg("My %s scores %d", s, (j == 0 ? 19 : j));
 	return (chkscr(&cscore, j));
 }
@@ -176,16 +173,15 @@
  */
 int Lastscore[2] = {-1, -1};
 
-int
-chkscr(scr, inc)
-	int    *scr, inc;
+bool
+chkscr(int *scr, int inc)
 {
-	BOOLEAN myturn;
+	bool myturn;
 
 	myturn = (scr == &cscore);
 	if (inc != 0) {
-		prpeg(Lastscore[myturn ? 1 : 0], '.', myturn);
-		Lastscore[myturn ? 1 : 0] = *scr;
+		prpeg(Lastscore[myturn], '.', myturn);
+		Lastscore[myturn] = *scr;
 		*scr += inc;
 		prpeg(*scr, PEG, myturn);
 		refresh();
@@ -198,11 +194,8 @@
  *	Put out the peg character on the score board and put the
  *	score up on the board.
  */
-void
-prpeg(score, peg, myturn)
-	int score;
-	int peg;
-	BOOLEAN myturn;
+static void
+prpeg(int score, int peg, bool myturn)
 {
 	int y, x;
 
@@ -238,8 +231,7 @@
  * the crib and puts the best two cards at the end
  */
 void
-cdiscard(mycrib)
-	BOOLEAN mycrib;
+cdiscard(bool mycrib)
 {
 	CARD    d[CARDS], h[FULLHAND], cb[2];
 	int i, j, k;
@@ -266,11 +258,11 @@
 			cremove(chand[j], h, FULLHAND - 1);
 			for (k = 0; k < nc; k++) {
 				sums[ns] +=
-				    scorehand(h, d[k], CINHAND, TRUE, FALSE);
+				    scorehand(h, d[k], CINHAND, true, false);
 				if (mycrib)
-					sums[ns] += adjust(cb, d[k]);
+					sums[ns] += adjust(cb);
 				else
-					sums[ns] -= adjust(cb, d[k]);
+					sums[ns] -= adjust(cb);
 			}
 			++ns;
 		}
@@ -290,15 +282,13 @@
 /*
  * returns true if some card in hand can be played without exceeding 31
  */
-int
-anymove(hand, n, sum)
-	CARD hand[];
-	int n, sum;
+bool
+anymove(CARD hand[], int n, int sum)
 {
 	int i, j;
 
 	if (n < 1)
-		return (FALSE);
+		return (false);
 	j = hand[0].rank;
 	for (i = 1; i < n; i++) {
 		if (hand[i].rank < j)
@@ -311,10 +301,8 @@
  * anysumto returns the index (0 <= i < n) of the card in hand that brings
  * the s up to t, or -1 if there is none
  */
-int
-anysumto(hand, n, s, t)
-	CARD hand[];
-	int n, s, t;
+static int
+anysumto(CARD hand[], int n, int s, int t)
 {
 	int i;
 
@@ -328,10 +316,8 @@
 /*
  * return the number of cards in h having the given rank value
  */
-int
-numofval(h, n, v)
-	CARD h[];
-	int n, v;
+static int
+numofval(CARD h[], int n, int v)
 {
 	int i, j;
 
@@ -347,9 +333,7 @@
  * makeknown remembers all n cards in h for future recall
  */
 void
-makeknown(h, n)
-	CARD h[];
-	int n;
+makeknown(CARD h[], int n)
 {
 	int i;
 

Attachment: pgp00001.pgp
Description: PGP signature



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]