/**************************************************
 * common-types.h: Defines types and constants that
 * are used throughout the program.
 */

#ifndef CommonTypes_Included
#define CommonTypes_Included

#include <vector>
#include <deque>
using namespace std;

const int kNumPiles = 8; // Number of piles
const int kNumCells = 4; // Number of free cells.
 
/* Type: suitT
 * A type that stores the suit of a playing card.
 */
enum suitT {Hearts, Diamonds, Clubs, Spades, NumSuits};

/* Type: valueT
 * A type that stores the value of playing card.
 * Note that the values are sorted in increasing
 * order here, so you can compare cards by
 * value.
 */
enum valueT {Ace, Two, Three, Four, Five, Six, Seven,
             Eight, Nine, Ten, Jack, Queen, King,
			 NumValues};

/* Type: cardT
 * A type that represents a playing card.
 */
struct cardT
{
	suitT suit;
	valueT value;
};

/* A type representing a cell.  If 'isFilled' is true, the cell is filled
 * and contains card 'card.'  Otherwise, if 'isFilled' is false, the value
 * of 'card' is ignored.
 */
struct cellT
{
	cardT card;
	bool isFilled;
};

/* A struct representing the game of FreeCell. */
struct gameT
{
	vector<cellT> cells;
	vector<cellT> done;
	vector<deque<cardT> > piles;
};



/* An enumerated type describing where something is -
 * in a pile (Pile), in one of the free cells (Cell), or
 * in the done pile (Done)
 */
enum locationT {Pile, Cell, Done};
struct placeT
{
	locationT type;
	int index;
};

/* Helper functions. */
cardT  MakeCard (suitT suit, valueT value);
cellT  MakeCell (cardT card, bool isFilled);
placeT MakePlace(locationT type, int index);

#endif
