X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=8ba5b41af8be9cf182a02650dc9457d7fa515239;hp=a7c169ac1af1832945c8100e99c2d44bfe6fca3b;hb=d3608c4e79a29110f4c4a369d7207c6dd8e01f34;hpb=8ceef922662c75c33d105d99732475c125b01081 diff --git a/src/search.cpp b/src/search.cpp index a7c169ac..8ba5b41a 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -163,7 +163,7 @@ size_t Search::perft(Position& pos, Depth depth) { size_t cnt = 0; CheckInfo ci(pos); - for (MoveList it(pos); !it.end(); ++it) + for (MoveList it(pos); *it; ++it) { pos.do_move(*it, st, ci, pos.move_gives_check(*it, ci)); cnt += perft(pos, depth - ONE_PLY); @@ -766,7 +766,11 @@ namespace { split_point_start: // At split points actual search starts from here - MovePicker mp(pos, ttMove, depth, History, Countermoves, ss, PvNode ? -VALUE_INFINITE : beta); + Square prevMoveSq = to_sq((ss-1)->currentMove); + Move countermoves[] = { Countermoves[pos.piece_on(prevMoveSq)][prevMoveSq].first, + Countermoves[pos.piece_on(prevMoveSq)][prevMoveSq].second }; + + MovePicker mp(pos, ttMove, depth, History, countermoves, ss, PvNode ? -VALUE_INFINITE : beta); CheckInfo ci(pos); value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc singularExtensionNode = !RootNode @@ -942,6 +946,9 @@ split_point_start: // At split points actual search starts from here && move != ss->killers[1]) { ss->reduction = reduction(depth, moveCount); + if (move == countermoves[0] || move == countermoves[1]) + ss->reduction = std::max(DEPTH_ZERO, ss->reduction-ONE_PLY); + Depth d = std::max(newDepth - ss->reduction, ONE_PLY); if (SpNode) alpha = splitPoint->alpha; @@ -1093,10 +1100,7 @@ split_point_start: // At split points actual search starts from here Value bonus = Value(int(depth) * int(depth)); History.update(pos.piece_moved(bestMove), to_sq(bestMove), bonus); if (is_ok((ss-1)->currentMove)) - { - Square prevSq = to_sq((ss-1)->currentMove); - Countermoves.update(pos.piece_on(prevSq), prevSq, bestMove); - } + Countermoves.update(pos.piece_on(prevMoveSq), prevMoveSq, bestMove); // Decrease history of all the other played non-capture moves for (int i = 0; i < playedMoveCount - 1; i++)