//////////////////////////////////////////////////
// (c) MMIII Sven Reichard
// 

# include <BookTraining.h>
namespace Alice
{
namespace XBoard
{
BookTraining::BookTraining( std::istream& in, std::ostream& out )
  : XBoardBase( in, out )
{

};

BookTraining::~BookTraining()
{

};

void
BookTraining::readBook( std::istream& bookStream )
{
  moves.read( bookStream );
};

void
BookTraining::search()
{
  moves.makeMove( output );
  output << std::endl;
};

void
BookTraining::usermove()
{
  std::string san;
  input >> san;
  if (moves.checkMove(san))
    search();
  else
    {
      output<<"telluser wrong move " << san ;
      output<<", should be: ";
      moves.makeMove( output );
      output << std::endl;
    }
};

void
BookTraining::newGame()
{
  moves.reset();
};

}; // namespace XBoard
}; // namespace Alice
