Example #1
0
static bool ponder_move_is_ok(int move) {

   int status;
   board_t board[1];

   ASSERT(move==MoveNone||move_is_ok(move));

   // legal ponder move?

   if (move == MoveNone) return false;

   game_get_board(Game,board);
   if (!move_is_legal(move,board)) return false;

   // UCI-legal resulting position?

   game_add_move(Game,move);

   game_get_board(Game,board);
   status = game_status(Game);

   game_rem_move(Game);

   if (status != PLAYING) return false; // game ended

   if (option_get_bool("Book") && is_in_book(board)) {
      return false;
   }

   return true;
}
Example #2
0
static void move_step(int move) {

   board_t board[1];
   char move_string[256];

   ASSERT(move_is_ok(move));

   // log

   game_get_board(Game,board);

   if (move != MoveNone && move_is_legal(move,board)) {

      move_to_san(move,board,move_string,256);
      my_log("POLYGLOT MOVE %s\n",move_string);

   } else {

      move_to_can(move,board,move_string,256);
      my_log("POLYGLOT ILLEGAL MOVE \"%s\"\n",move_string);
      board_disp(board);

      my_fatal("move_step(): illegal move \"%s\"\n",move_string);
   }

   // play the move

   game_add_move(Game,move);
   board_update();
}
Example #3
0
static void move_step(int move) {

   board_t board[1];
   char move_string[256];

   ASSERT(move_is_ok(move));

   // log

   game_get_board(Game,board);

   if (XB->ics || (move != MoveNone && move_is_legal(move,board))) {

      move_to_san(move,board,move_string,sizeof(move_string));
      my_log("POLYGLOT MOVE %s\n",move_string);

   } else {
      move_to_can(move,board,move_string,sizeof(move_string));
      my_log("POLYGLOT ILLEGAL MOVE \"%s\"\n",move_string);
      board_disp(board);
	  //since we have threads my_fatal is not enough,1 thread will wait for xboard to end the game
	  //stuff illegal move in the comment as well,not everybody logs all the time.
	  if(board->turn==White)
		  xboard_send(XBoard,"0-1 {polyglot: %s illegal engine move white}\n",move_string);
	  else
		  xboard_send(XBoard,"1-0 {polyglot: %s illegal engine move black}\n",move_string);
      my_fatal("move_step(): illegal move \"%s\"\n",move_string);
   }

   // play the move

   game_add_move(Game,move);
   //board_update();
}