X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=80eeb717f52d548897a5fdf4b7d9119d908aaefd;hp=c5d6e36bf153649cb788a3c2ea87b435a030029d;hb=7d717df4e4e6284449c3588bd75a45cbb5f307da;hpb=d3600c39a745179ed6b094b305d0645e83a1ee86 diff --git a/src/search.cpp b/src/search.cpp index c5d6e36b..80eeb717 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1996,26 +1996,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); }