X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=f4f411c56d18f266f110d69ba5d4aa0b8c9707ad;hp=4ca9e9b8c0f834d8ccbcf91e3defdeae9fed24bd;hb=e215a88cddd16e09cd77618bd3b793957dea7dc1;hpb=3b8f66f8accefe86db9296fa276e4b33cdc450e2 diff --git a/src/search.cpp b/src/search.cpp index 4ca9e9b8..f4f411c5 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -155,21 +155,17 @@ void Search::init() { size_t Search::perft(Position& pos, Depth depth) { - // At the last ply just return the number of legal moves (leaf nodes) - if (depth == ONE_PLY) - return MoveList(pos).size(); - StateInfo st; size_t cnt = 0; CheckInfo ci(pos); + const bool leaf = depth == 2 * ONE_PLY; for (MoveList it(pos); *it; ++it) { pos.do_move(*it, st, ci, pos.move_gives_check(*it, ci)); - cnt += perft(pos, depth - ONE_PLY); + cnt += leaf ? MoveList(pos).size() : perft(pos, depth - ONE_PLY); pos.undo_move(*it); } - return cnt; } @@ -726,7 +722,6 @@ namespace { && depth >= 5 * ONE_PLY && !inCheck && !ss->skipNullMove - && excludedMove == MOVE_NONE && abs(beta) < VALUE_MATE_IN_MAX_PLY) { Value rbeta = beta + 200; @@ -948,6 +943,10 @@ split_point_start: // At split points actual search starts from here && move != ss->killers[1]) { ss->reduction = reduction(depth, moveCount); + + if (!PvNode && cutNode) + ss->reduction += ONE_PLY; + if (move == countermoves[0] || move == countermoves[1]) ss->reduction = std::max(DEPTH_ZERO, ss->reduction-ONE_PLY);