contest/
contest/Merc21/
contest/Merc21/log/
contest/Merc21/player/
/******************************************************************************
 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_DECK
#define HEADER_DECK

/******************************************************************************
 Headers
 ******************************************************************************/

#include "game.h"
#include "card.h"

/******************************************************************************
 Structures
 ******************************************************************************/

typedef struct 
{
   game_t     Game;            /* The type of game being played          */
   int        Size;            /* Size of the deck (i.e., undrawn cards) */
   int        Instances;       /* How many people are using this deck    */
   int        Bet;             /* The current bet                        */
   int        Pot;             /* The total amount of money in the pot   */
   int        Turn;            /* The game turn                          */
   boolean_t  Playing;         /* The game has started play              */
   card_t     Card[eCardMax];  /* An array of cards in the deck          */
   boolean_t  Drawn[eCardMax]; /* Has the card been drawn from the deck? */
} deck_t;

/******************************************************************************
 Global functions
 ******************************************************************************/

/* Function to create a deck of 52 cards */
deck_t     *DeckCreate( void );

/* Function to shuffle a deck of cards */
void        DeckShuffle( deck_t *apDeck );

/* Function to remove and return the top card from the deck */
card_t      DeckDrawCard( deck_t *apDeck );

/* Function to return a card to the bottom of the deck */
boolean_t   DeckReturnCard( deck_t *apDeck, card_t aCard );

/* Function to return the number of cards in the deck */
int         DeckCountCards( deck_t *apDeck );

/* Function to reset the deck to 52 cards */
void        DeckReset( deck_t *apDeck );

/* Function to return the values of all the cards currently in the deck */
const char *DeckShow( deck_t *apDeck, boolean_t abUndrawn, boolean_t abFormat );

#endif /* HEADER_DECK */