summaryrefslogtreecommitdiff
path: root/games/cribbage/score.c
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>1998-08-19 07:42:28 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>1998-08-19 07:42:28 +0000
commited884b9fa4509c09f0f7ab71efe57a4e83a2e055 (patch)
treeef9d859a0754785b42ea5cacb27aff54b5000315 /games/cribbage/score.c
parentf4fc9566a4d35c0cc2bf8c7f1136287d8eec8c44 (diff)
tags, formatting, ANSI-fication, prototypes, de-typos, and the occasional
initialization, removal of unused variable, or other minor fix. Most changes are from or inspired by NetBSD.
Diffstat (limited to 'games/cribbage/score.c')
-rw-r--r--games/cribbage/score.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/games/cribbage/score.c b/games/cribbage/score.c
index 93f8c075efd..369b03399f7 100644
--- a/games/cribbage/score.c
+++ b/games/cribbage/score.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: score.c,v 1.2 1998/08/19 07:40:24 pjanzen Exp $ */
/* $NetBSD: score.c,v 1.3 1995/03/21 15:08:57 cgd Exp $ */
/*-
@@ -37,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: score.c,v 1.3 1995/03/21 15:08:57 cgd Exp $";
+static char rcsid[] = "$OpenBSD: score.c,v 1.2 1998/08/19 07:40:24 pjanzen Exp $";
#endif
#endif /* not lint */
@@ -109,19 +110,19 @@ static int pairpoints, runpoints; /* Globals from pairuns. */
*/
int
scorehand(hand, starter, n, crb, do_explain)
- register CARD hand[];
+ CARD hand[];
CARD starter;
int n;
BOOLEAN crb; /* true if scoring crib */
BOOLEAN do_explain; /* true if must explain this hand */
{
- register int i, k;
- register int score;
- register BOOLEAN flag;
+ int i, k;
+ int score;
+ BOOLEAN flag;
CARD h[(CINHAND + 1)];
char buf[32];
- expl[0] = NULL; /* initialize explanation */
+ expl[0] = '\0'; /* initialize explanation */
score = 0;
flag = TRUE;
k = hand[0].suit;
@@ -137,7 +138,7 @@ scorehand(hand, starter, n, crb, do_explain)
}
if (flag && n >= CINHAND) {
- if (do_explain && expl[0] != NULL)
+ if (do_explain && expl[0] != '\0')
strcat(expl, ", ");
if (starter.suit == k) {
score += 5;
@@ -146,33 +147,35 @@ scorehand(hand, starter, n, crb, do_explain)
} else
if (!crb) {
score += 4;
- if (do_explain && expl[0] != NULL)
+ if (do_explain && expl[0] != '\0')
strcat(expl, ", Four-flush");
else
strcpy(expl, "Four-flush");
}
}
- if (do_explain && expl[0] != NULL)
+ if (do_explain && expl[0] != '\0')
strcat(expl, ", ");
h[n] = starter;
sorthand(h, n + 1); /* sort by rank */
i = 2 * fifteens(h, n + 1);
score += i;
- if (do_explain)
+ if (do_explain) {
if (i > 0) {
(void) sprintf(buf, "%d points in fifteens", i);
strcat(expl, buf);
} else
strcat(expl, "No fifteens");
+ }
i = pairuns(h, n + 1);
score += i;
- if (do_explain)
+ if (do_explain) {
if (i > 0) {
(void) sprintf(buf, ", %d points in pairs, %d in runs",
pairpoints, runpoints);
strcat(expl, buf);
} else
strcat(expl, ", No pairs/runs");
+ }
return (score);
}
@@ -182,12 +185,12 @@ scorehand(hand, starter, n, crb, do_explain)
*/
int
fifteens(hand, n)
- register CARD hand[];
+ CARD hand[];
int n;
{
- register int *sp, *np;
- register int i;
- register CARD *endp;
+ int *sp, *np;
+ int i;
+ CARD *endp;
static int sums[15], nsums[15];
np = nsums;
@@ -228,7 +231,7 @@ pairuns(h, n)
CARD h[];
int n;
{
- register int i;
+ int i;
int runlength, runmult, lastmult, curmult;
int mult1, mult2, pair1, pair2;
BOOLEAN run;
@@ -298,7 +301,7 @@ pegscore(crd, tbl, n, sum)
int n, sum;
{
BOOLEAN got[RANKS];
- register int i, j, scr;
+ int i, j, scr;
int k, lo, hi;
sum += VAL(crd.rank);