X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fsearch.cpp;h=704cf720008d76e300b512ad378c99a14c0900ca;hb=f6d245291664e1a521b3810051365c48c82bac78;hp=32d1a8bdb32512b1355d5f47b24b9376a7494a70;hpb=4251eac8601af47d1ee2d6f613f00a4bf00fedbb;p=stockfish diff --git a/src/search.cpp b/src/search.cpp index 32d1a8bd..704cf720 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -190,9 +190,6 @@ namespace { // Remaining depth: 1 ply 1.5 ply 2 ply 2.5 ply 3 ply 3.5 ply const Value RazorApprMargins[6] = { Value(0x520), Value(0x300), Value(0x300), Value(0x300), Value(0x300), Value(0x300) }; - // The main transposition table - TranspositionTable TT; - /// Variables initialized by UCI options @@ -663,7 +660,6 @@ namespace { // Initialize TT.new_search(); - p.setTranspositionTable(&TT); H.clear(); for (int i = 0; i < 3; i++) { @@ -1285,13 +1281,15 @@ namespace { bool mateThreat = false; bool isCheck = pos.is_check(); + bool useNullMove = ( allowNullmove + && depth > OnePly + && !isCheck + && !value_is_mate(beta) + && ok_to_do_nullmove(pos) + && approximateEval >= beta - NullMoveMargin); + // Null move search - if ( allowNullmove - && depth > OnePly - && !isCheck - && !value_is_mate(beta) - && ok_to_do_nullmove(pos) - && approximateEval >= beta - NullMoveMargin) + if (useNullMove) { ss[ply].currentMove = MOVE_NULL; @@ -1330,12 +1328,13 @@ namespace { } } // Null move search not allowed, try razoring - else if ( !value_is_mate(beta) - && depth < RazorDepth - && approximateEval < beta - RazorApprMargins[int(depth) - 2] - && ss[ply - 1].currentMove != MOVE_NULL - && ttMove == MOVE_NONE - && !pos.has_pawn_on_7th(pos.side_to_move())) + if ( !useNullMove + && !value_is_mate(beta) + && depth < RazorDepth + && approximateEval < beta - RazorApprMargins[int(depth) - 2] + && ss[ply - 1].currentMove != MOVE_NULL + && ttMove == MOVE_NONE + && !pos.has_pawn_on_7th(pos.side_to_move())) { Value v = qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID); if (v < beta - RazorMargins[int(depth) - 2]) @@ -2271,12 +2270,13 @@ namespace { if (pos.type_of_piece_on(move_from(m)) == PAWN) { - if (pos.move_is_pawn_push_to_7th(m)) + Color c = pos.side_to_move(); + if (relative_rank(c, move_to(m)) == RANK_7) { result += PawnPushTo7thExtension[pvNode]; *dangerous = true; } - if (pos.move_is_passed_pawn_push(m)) + if (pos.pawn_is_passed(c, move_to(m))) { result += PassedPawnExtension[pvNode]; *dangerous = true;