-/* $NetBSD: cards.c,v 1.3 1995/03/21 15:08:41 cgd Exp $ */
+/* $NetBSD: cards.c,v 1.8 2005/07/02 08:32:32 jmc Exp $ */
/*-
* Copyright (c) 1980, 1993
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
#ifndef lint
+#if 0
static char sccsid[] = "@(#)cards.c 8.1 (Berkeley) 5/31/93";
+#else
+__RCSID("$NetBSD: cards.c,v 1.8 2005/07/02 08:32:32 jmc Exp $");
+#endif
#endif /* not lint */
#include <curses.h>
* Initialize a deck of cards to contain one of each type.
*/
void
-makedeck(d)
- CARD d[];
+makedeck(CARD d[])
{
- register int i, j, k;
+ int i, j, k;
i = time(NULL);
i = ((i & 0xff) << 8) | ((i >> 8) & 0xff) | 1;
* see Knuth, vol. 2, page 125.
*/
void
-shuffle(d)
- CARD d[];
+shuffle(CARD d[])
{
- register int j, k;
+ int j, k;
CARD c;
for (j = CARDS; j > 0; --j) {
* return true if the two cards are equal...
*/
int
-eq(a, b)
- CARD a, b;
+eq(CARD a, CARD b)
{
return ((a.rank == b.rank) && (a.suit == b.suit));
}
/*
- * isone returns TRUE if a is in the set of cards b
+ * is_one returns TRUE if a is in the set of cards b
*/
int
-isone(a, b, n)
- CARD a, b[];
- int n;
+is_one(CARD a, const CARD b[], int n)
{
- register int i;
+ int i;
for (i = 0; i < n; i++)
if (eq(a, b[i]))
* 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)
{
- register int i, j;
+ int i, j;
for (i = j = 0; i < n; i++)
if (!eq(a, d[i]))
* Sort a hand of n cards
*/
void
-sorthand(h, n)
- register CARD h[];
- int n;
+sorthand(CARD h[], int n)
{
- register CARD *cp, *endp;
+ CARD *cp, *endp;
CARD c;
for (endp = &h[n]; h < endp - 1; h++)