// the UCI protocol states that we shouldn't print the best move before the
// GUI sends a "stop" or "ponderhit" command. We therefore simply wait here
// until the GUI sends one of those commands (which also raises Threads.stop).
// the UCI protocol states that we shouldn't print the best move before the
// GUI sends a "stop" or "ponderhit" command. We therefore simply wait here
// until the GUI sends one of those commands (which also raises Threads.stop).
- if (!Threads.stop && (Limits.ponder || Limits.infinite))
- {
- Threads.stopOnPonderhit = true;
- wait(Threads.stop);
- }
+ Threads.stopOnPonderhit = true;
+
+ while (!Threads.stop && (Threads.ponder || Limits.infinite))
+ {} // Busy wait for a stop or a ponder reset
{
// If we are allowed to ponder do not stop the search now but
// keep pondering until the GUI sends "ponderhit" or "stop".
{
// If we are allowed to ponder do not stop the search now but
// keep pondering until the GUI sends "ponderhit" or "stop".
Value bestValue, value, ttValue, eval;
bool ttHit, inCheck, givesCheck, singularExtensionNode, improving;
bool captureOrPromotion, doFullDepthSearch, moveCountPruning, skipQuiets, ttCapture;
Value bestValue, value, ttValue, eval;
bool ttHit, inCheck, givesCheck, singularExtensionNode, improving;
bool captureOrPromotion, doFullDepthSearch, moveCountPruning, skipQuiets, ttCapture;
int moveCount, quietCount;
// Step 1. Initialize node
int moveCount, quietCount;
// Step 1. Initialize node
givesCheck = type_of(move) == NORMAL && !pos.discovered_check_candidates()
? pos.check_squares(type_of(pos.piece_on(from_sq(move)))) & to_sq(move)
givesCheck = type_of(move) == NORMAL && !pos.discovered_check_candidates()
? pos.check_squares(type_of(pos.piece_on(from_sq(move)))) & to_sq(move)
- && (*contHist[0])[moved_piece][to_sq(move)] < CounterMovePruneThreshold
- && (*contHist[1])[moved_piece][to_sq(move)] < CounterMovePruneThreshold)
+ && (*contHist[0])[movedPiece][to_sq(move)] < CounterMovePruneThreshold
+ && (*contHist[1])[movedPiece][to_sq(move)] < CounterMovePruneThreshold)
// Step 14. Make the move
pos.do_move(move, st, givesCheck);
// Step 14. Make the move
pos.do_move(move, st, givesCheck);
- + (*contHist[0])[moved_piece][to_sq(move)]
- + (*contHist[1])[moved_piece][to_sq(move)]
- + (*contHist[3])[moved_piece][to_sq(move)]
+ + (*contHist[0])[movedPiece][to_sq(move)]
+ + (*contHist[1])[movedPiece][to_sq(move)]
+ + (*contHist[3])[movedPiece][to_sq(move)]