xref: /dragonfly/games/cribbage/deck.h (revision 86d7f5d3)
1 /*-
2  * Copyright (c) 1980, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the University nor the names of its contributors
14  *    may be used to endorse or promote products derived from this software
15  *    without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  *	@(#)deck.h	8.1 (Berkeley) 5/31/93
30  * $DragonFly: src/games/cribbage/deck.h,v 1.2 2005/08/03 13:31:00 eirikn Exp $
31  */
32 
33 /*
34  * define structure of a deck of cards and other related things
35  */
36 
37 
38 #define		CARDS		52		/* number cards in deck */
39 #define		RANKS		13		/* number ranks in deck */
40 #define		SUITS		4		/* number suits in deck */
41 
42 #define		CINHAND		4		/* # cards in cribbage hand */
43 #define		FULLHAND	6		/* # cards in dealt hand */
44 
45 #define		LGAME		121		/* number points in a game */
46 #define		SGAME		61		/* # points in a short game */
47 
48 #define		SPADES		0		/* value of each suit */
49 #define		HEARTS		1
50 #define		DIAMONDS	2
51 #define		CLUBS		3
52 
53 #define		ACE		0		/* value of each rank */
54 #define		TWO		1
55 #define		THREE		2
56 #define		FOUR		3
57 #define		FIVE		4
58 #define		SIX		5
59 #define		SEVEN		6
60 #define		EIGHT		7
61 #define		NINE		8
62 #define		TEN		9
63 #define		JACK		10
64 #define		QUEEN		11
65 #define		KING		12
66 #define		EMPTY		13
67 
68 #define		VAL(c)		( (c) < 9 ? (c)+1 : 10 )    /* val of rank */
69 
70 
71 typedef	struct  {
72 	int		rank;
73 	int		suit;
74 } CARD;
75