X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsearch.cpp;h=f29041847c0ae033cc4b25d403f266fc633a15f5;hb=74f1efee263aadcceb1df716ebd87776b932238a;hp=c5d6e36bf153649cb788a3c2ea87b435a030029d;hpb=5dc23121215039938a9ef4e59ae934312774571c;p=stockfish diff --git a/src/search.cpp b/src/search.cpp index c5d6e36b..f2904184 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -931,6 +931,7 @@ namespace { { assert(move_is_ok(move)); + bool fewMoves = (depth <= OnePly && mp.number_of_moves() < 4); bool singleReply = (pos.is_check() && mp.number_of_moves() == 1); bool moveIsCheck = pos.move_is_check(move, dcCandidates); bool moveIsCapture = pos.move_is_capture(move); @@ -942,7 +943,7 @@ namespace { PawnValueMidgame : pos.midgame_value_of_piece_on(move_to(move)); // Decide the new search depth - Depth ext = extension(pos, move, true, moveIsCheck, singleReply, mateThreat); + Depth ext = extension(pos, move, true, moveIsCheck, singleReply || fewMoves, mateThreat); Depth newDepth = depth - OnePly + ext; // Make and search the move @@ -1996,26 +1997,35 @@ namespace { Depth extension(const Position &pos, Move m, bool pvNode, bool check, bool singleReply, bool mateThreat) { + Depth result = Depth(0); - if(check) - result += CheckExtension[pvNode]; - if(singleReply) - result += SingleReplyExtension[pvNode]; - if(pos.move_is_pawn_push_to_7th(m)) - result += PawnPushTo7thExtension[pvNode]; - if(pos.move_is_passed_pawn_push(m)) - result += PassedPawnExtension[pvNode]; - if(mateThreat) - result += MateThreatExtension[pvNode]; - if(pos.midgame_value_of_piece_on(move_to(m)) >= RookValueMidgame - && (pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK) - - pos.midgame_value_of_piece_on(move_to(m)) == Value(0)) - && !move_promotion(m)) - result += PawnEndgameExtension[pvNode]; - if(pvNode && pos.move_is_capture(m) - && pos.type_of_piece_on(move_to(m)) != PAWN && pos.see(m) >= 0) - result += OnePly/2; + if (check) + result += CheckExtension[pvNode]; + + if (singleReply) + result += SingleReplyExtension[pvNode]; + + if (pos.move_is_pawn_push_to_7th(m)) + result += PawnPushTo7thExtension[pvNode]; + + if (pos.move_is_passed_pawn_push(m)) + result += PassedPawnExtension[pvNode]; + + if (mateThreat) + result += MateThreatExtension[pvNode]; + + if ( pos.midgame_value_of_piece_on(move_to(m)) >= RookValueMidgame + && ( pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK) + - pos.midgame_value_of_piece_on(move_to(m)) == Value(0)) + && !move_promotion(m)) + result += PawnEndgameExtension[pvNode]; + + if ( pvNode + && pos.move_is_capture(m) + && pos.type_of_piece_on(move_to(m)) != PAWN + && pos.see(m) >= 0) + result += OnePly/2; return Min(result, OnePly); }