//////////////////////////////////////////////////////////
// The Jewel Game                                       //
// by Nick Cash                                         //
//                                                      //
// Fall 2007                                            //
// 810:161 - Artificial Intelligence                    //
//                                                      //
// game.h - Include file containing function prototypes //
//          and class declarations                      //
//////////////////////////////////////////////////////////

// Add in our inclusion guard
#ifndef INCLUDE_GAME
#define INCLUDE_GAME

// standard includes
#include <vector>
#include <list>
#include <string>

// Jewel class
class cJewel
{
  public: 
          cJewel();     // constructor
          cJewel(char); // constructor
         ~cJewel();     // destructor
         
         // Data manipulators
         void SetType(char);
         const char& GetType() { return type; }
         
         // operator overloads
         const cJewel& operator++();

  private:
         char type;
};

// GameBoard Class
class cGameBoard
{
   public:
          cGameBoard();            // constructor
          cGameBoard(std::string); // constructor
         ~cGameBoard();            // destructor
          
          void UpdateJewel( int, int ); // update a jewel and adjacent ones
          void Print( void );           // print current board status
          bool CheckWin();              // check if this is a winning board

          // Data manipulators
          void SetSpell( int x ) { spell = x; }
          int  GetSpell( void )  { return spell; }
          
          void SetDepth( int x ) { depth = x; }
          int  GetDepth( void )  { return depth; }
          int  GetDepth( void ) const  { return depth; }

   private:
           cJewel board[3][3];  // Holds our jewels
           int spell;           // What spell was cast on this board?
           int depth;           // What depth in the tree is this board?
};

// Any defines we need
#define MAX_DEPTH    18       // limit our max depth to 18, a solution will always be found

// global variables, defined in search.cpp
// 0 = Breadth
// 1 = DepthLimited
// 2 = Iterative Deepening
extern short search_function;

// Used for counters
extern unsigned int nodes_expanded;
extern unsigned int nodes_stored;

// function prototypes
bool SetupGameBoard(cGameBoard &board, int argc, char *argv[]);
void Error(const char*);
std::string AddSpaces( const std::string& str );

// This is our successor function
void GenerateBranches( const cGameBoard& parent, std::list<cGameBoard*>& lst, bool front );;

#endif // INCLUDE_GAME