示例#1
0
bool
UserCommandExecuter::execute (const UserCommand& command)
{
   switch (command.get_key ())
   {
   case UserCommand::NEW_GAME:
      this->board->reset ();
      break;

   case UserCommand::UNDO_MOVE:
      this->board->undo_move ();
      break;

   case UserCommand::REMOVE:
      this->board->undo_move ();
      this->board->undo_move ();
      break;

   case UserCommand::SEE_MOVES:
      show_possible_moves ();
      break;

   case UserCommand::USER_MOVE:
      make_user_move (command.get_notation ());
      break;

   case UserCommand::FEATURES:
      cout << "feature setboard=1 usermove=1 time=0 draw=0 sigint=0 "
           << "sigterm=0 variants=\"normal\" analyze=0 colors=0 "
           << "myname=\"MaE\" done=1" << std::endl;
      break;

   case UserCommand::XBOARD_MODE:
      cout << std::endl;
      break;

   case UserCommand::THINK:
      think ();
      break;

   case UserCommand::TRAIN:
      train_by_genetic_algorithm (
          /* population_size: */ 6,
          /* generations_count: */ 15,
          /* mutation_probability: */ 0.004);
      break;

   default:
      break;
   }
   return true;
}