/****************************************************************************** Copyright 2005-2007 Richard Woolcock. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * 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. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ #ifndef HEADER_HAND #define HEADER_HAND /****************************************************************************** Headers ******************************************************************************/ #include "card.h" /****************************************************************************** Structures ******************************************************************************/ typedef struct held_card_type held_card_t; struct held_card_type { card_t Card; held_card_t *pNext; }; typedef struct { int Size; /* Size of the hand (i.e., number of held cards) */ int Bet; /* Your current bet (i.e., what you last called) */ boolean_t bDealer; /* Are you the dealer? */ held_card_t *pHeld; /* Pointer to the first held card */ } hand_t; /****************************************************************************** Global functions ******************************************************************************/ /* Function to create a new hand */ hand_t *HandCreate( void ); /* Function to add a card to the hand */ boolean_t HandAddCard( hand_t *apHand, card_t aCard ); /* Function to remove a card from the hand */ boolean_t HandRemoveCard( hand_t *apHand, card_t aCard ); /* Function to return the number of cards in the hand */ int HandCountCards( hand_t *apHand ); /* Function to return how many cards of a specific suit the hand contains */ int HandGetSuit( hand_t *apHand, suit_t aSuit ); /* Function to return how many cards of a specific rank the hand contains */ int HandGetRank( hand_t *apHand, rank_t aRank ); /* Function returning the number of cards of a specific suit AND rank */ boolean_t HandGetSuitRank( hand_t *apHand, suit_t aSuit, rank_t aRank ); /* Function to return the values of all the cards currently in the hand */ const char *HandShow( hand_t *apHand, boolean_t abGraphical ); #endif /* HEADER_HAND */