/****************************************************************************** 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_CARD #define HEADER_CARD /****************************************************************************** Enumerated types ******************************************************************************/ typedef enum { eFalse, eTrue } boolean_t; typedef enum { eSuitClubs, eSuitSpades, eSuitHearts, eSuitDiamonds, eSuitMax } suit_t; typedef enum { eRankAce, eRankTwo, eRankThree, eRankFour, eRankFive, eRankSix, eRankSeven, eRankEight, eRankNine, eRankTen, eRankJack, eRankQueen, eRankKing, eRankMax } rank_t; typedef enum { eCardAceClubs, eCard2Clubs, eCard3Clubs, eCard4Clubs, eCard5Clubs, eCard6Clubs, eCard7Clubs, eCard8Clubs, eCard9Clubs, eCard10Clubs, eCardJackClubs, eCardQueenClubs, eCardKingClubs, eCardAceSpades, eCard2Spades, eCard3Spades, eCard4Spades, eCard5Spades, eCard6Spades, eCard7Spades, eCard8Spades, eCard9Spades, eCard10Spades, eCardJackSpades, eCardQueenSpades, eCardKingSpades, eCardAceHearts, eCard2Hearts, eCard3Hearts, eCard4Hearts, eCard5Hearts, eCard6Hearts, eCard7Hearts, eCard8Hearts, eCard9Hearts, eCard10Hearts, eCardJackHearts, eCardQueenHearts, eCardKingHearts, eCardAceDiamonds, eCard2Diamonds, eCard3Diamonds, eCard4Diamonds, eCard5Diamonds, eCard6Diamonds, eCard7Diamonds, eCard8Diamonds, eCard9Diamonds, eCard10Diamonds, eCardJackDiamonds, eCardQueenDiamonds, eCardKingDiamonds, eCardMax } card_t; /****************************************************************************** Global functions ******************************************************************************/ /* Initialisation function, called automatically by DeckCreate() */ boolean_t CardInit( void ); /* Function to return the value of the specific card (eg 'C8') */ const char *CardValue( card_t aCard ); /* Function to return the name of the specific card (eg 'Eight of Clubs') */ const char *CardName( card_t aCard ); /* Function to return the card type when you know the suit and rank */ card_t CardType( suit_t aSuit, rank_t aRank ); /* Function to return the rank of a character representation */ rank_t CardRank( char aRankRepresentation ); /* Function to return the character representation of a rank */ char CardRankRepresentation( rank_t aRank ); /* Function to return the suit of a character representation */ suit_t CardSuit( char aSuitRepresentation ); /* Function to return the character representation of a suit */ char CardSuitRepresentation( suit_t aSuit ); /* Function to return the graphic representation of a card (row 0-10) */ const char *CardGraphicRepresentation( int aRow, suit_t aSuit, rank_t aRank ); #endif /* HEADER_CARD */