// P-4 MCS 360 due Mon 15 Nov 2010 : checkerboard.h

/* The class board represent a checkerboard for the game of "box the fox".
   The move method implements a very basic backtracking mechanism for
   the computer to select the best move. */

#include <utility>
#include <string>
#include <vector>

class checkerboard
{
   public:

      checkerboard();
      // initializes checkerboard

      std::string to_string();
      // writes a checkerboard

      int distances();
      // returns sum of distances between
      // the fox and the hunters

      void move(int level);
      // if level == 0, hunters make random move,
      // otherwise computer looks as many levels ahead
      // as the value of level

      void go();
      // prompts the user for a move

      bool fox_wins();
      // returns true if hunters are outfoxed

      bool game_over();
      // returns true if fox it at opposite end
      // or if the fox is boxed in

   private:

      bool free( int row, int column );
      // returns true if there is no hunter
      // in the given row and column

      void random_move();
      // hunters make a move at random

      int hunter_move ( int k, int level );
      // enumerates all possible moves up to as many levels
      // as level and makes the best possible hunter move
      // precondition: k == level > 0 and level % 2 == 1 

      std::vector< std::pair<int,int> > hunters;
      std::pair<int,int> fox;
};

