Subversion Repositories Games.Chess Giants

Rev

Rev 1 | Rev 7 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1 Rev 2
Line 319... Line 319...
319
      if (!is_hint && (options.engine.blunder_chances > 0) && (rand () % 100 < options.engine.blunder_chances)
319
      if (!is_hint && (options.engine.blunder_chances > 0) && (rand () % 100 < options.engine.blunder_chances)
320
          && Move_FindRandomMove (&the_board.moves[the_board.move_count - 1], player->color, &move))
320
          && Move_FindRandomMove (&the_board.moves[the_board.move_count - 1], player->color, &move))
321
      {
321
      {
322
         Move_DescribeInSAN (&move); // build the forced move string
322
         Move_DescribeInSAN (&move); // build the forced move string
323
         Player_SendBuffer_Add (player, 1000, L"%s %s\n", options.engine.command_force, move.pgntext); // send it to the engine
323
         Player_SendBuffer_Add (player, 1000, L"%s %s\n", options.engine.command_force, move.pgntext); // send it to the engine
324
#ifndef NDEBUG
-
 
325
         Player_SendBuffer_Add (player, 1000, L"disp\n");
324
         Player_SendBuffer_Add (player, 1000, L"disp\n");
326
#endif
-
 
327
         Debug_Log (L"===Discarding engine move, forcing a blunderous move (%s) instead===\n", move.pgntext); // blunder
325
         Debug_Log (L"===Discarding engine move, forcing a blunderous move (%s) instead===\n", move.pgntext); // blunder
328
      }
326
      }
329
 
327
 
330
      // mark the engine's selected and hovered squares
328
      // mark the engine's selected and hovered squares
331
      Board_SetSelectedAndHovered (&the_board, move.source[0], move.source[1], move.target[0], move.target[1]);
329
      Board_SetSelectedAndHovered (&the_board, move.source[0], move.source[1], move.target[0], move.target[1]);
Line 385... Line 383...
385
      Player_SendBuffer_Add (player, 1000, L"%s %s\n", options.engine.command_setboard, the_board.moves[the_board.move_count - 1].fen_string);
383
      Player_SendBuffer_Add (player, 1000, L"%s %s\n", options.engine.command_setboard, the_board.moves[the_board.move_count - 1].fen_string);
386
 
384
 
387
      // and reset current obstinacy
385
      // and reset current obstinacy
388
      current_obstinacy = 0;
386
      current_obstinacy = 0;
389
 
387
 
390
#ifndef NDEBUG
-
 
391
      Player_SendBuffer_Add (player, 1000, L"disp\n");
388
      Player_SendBuffer_Add (player, 1000, L"disp\n");
392
#endif
-
 
393
   }
389
   }
394
 
390
 
395
   // have we been notified that players are swapping colors ? (N.B. when this happens in human vs. computer mode, it's always that the human player is *GIVING* his turn)
391
   // have we been notified that players are swapping colors ? (N.B. when this happens in human vs. computer mode, it's always that the human player is *GIVING* his turn)
396
   if (the_board.want_playerswap)
392
   if (the_board.want_playerswap)
397
   {
393
   {
Line 409... Line 405...
409
      {
405
      {
410
         // is it NOT a board setup AND has at least one move been played (meaning it was just the other's turn before) ?
406
         // is it NOT a board setup AND has at least one move been played (meaning it was just the other's turn before) ?
411
         if (!the_board.was_setup && (the_board.move_count > 1))
407
         if (!the_board.was_setup && (the_board.move_count > 1))
412
         {
408
         {
413
            Debug_Log (L"===Player just played, sending Crafty the chosen move===\n");
409
            Debug_Log (L"===Player just played, sending Crafty the chosen move===\n");
414
#ifndef NDEBUG
-
 
415
            Player_SendBuffer_Add (player, 1000, L"disp\n");
410
            Player_SendBuffer_Add (player, 1000, L"disp\n");
416
#endif
-
 
417
 
411
 
418
            // instruct it about its allowed search depth BEFORE each move (this ensures engine will be "ready" to handle the command)
412
            // instruct it about its allowed search depth BEFORE each move (this ensures engine will be "ready" to handle the command)
419
            // then build the move string, and send the move string to the engine
413
            // then build the move string, and send the move string to the engine
420
            Player_SendBuffer_Add (player, 1000, L"%s %d\n", options.engine.command_sd, options.engine.depth);
414
            Player_SendBuffer_Add (player, 1000, L"%s %d\n", options.engine.command_sd, options.engine.depth);
421
            Move_BuildString (&the_board.moves[the_board.move_count - 1], line_buffer, WCHAR_SIZEOF (line_buffer));
415
            Move_BuildString (&the_board.moves[the_board.move_count - 1], line_buffer, WCHAR_SIZEOF (line_buffer));
Line 459... Line 453...
459
         // instruct it about its allowed search depth BEFORE each table set (this ensures engine will be "ready" to handle the command)
453
         // instruct it about its allowed search depth BEFORE each table set (this ensures engine will be "ready" to handle the command)
460
         // then get the current game state in FEN format and feed it to the engine
454
         // then get the current game state in FEN format and feed it to the engine
461
         Player_SendBuffer_Add (player, 1000, L"%s %d\n", options.engine.command_sd, options.engine.depth);
455
         Player_SendBuffer_Add (player, 1000, L"%s %d\n", options.engine.command_sd, options.engine.depth);
462
         Player_SendBuffer_Add (player, 1000, L"%s %s\n", options.engine.command_setboard, the_board.moves[the_board.move_count - 1].fen_string);
456
         Player_SendBuffer_Add (player, 1000, L"%s %s\n", options.engine.command_setboard, the_board.moves[the_board.move_count - 1].fen_string);
463
 
457
 
464
#ifndef NDEBUG
-
 
465
         Player_SendBuffer_Add (player, 1000, L"disp\n");
458
         Player_SendBuffer_Add (player, 1000, L"disp\n");
466
#endif
-
 
467
 
459
 
468
         do_update = true; // remember to update the 3D scene
460
         do_update = true; // remember to update the 3D scene
469
      }
461
      }
470
   }
462
   }
471
 
463