Merge branch 'master' of github.com:official-stockfish/Stockfish into nnue-player-merge

This commit is contained in:
nodchip
2020-08-08 19:47:32 +09:00
2 changed files with 13 additions and 7 deletions
+5 -5
View File
@@ -111,7 +111,7 @@ namespace {
constexpr Value LazyThreshold1 = Value(1400); constexpr Value LazyThreshold1 = Value(1400);
constexpr Value LazyThreshold2 = Value(1300); constexpr Value LazyThreshold2 = Value(1300);
constexpr Value SpaceThreshold = Value(12222); constexpr Value SpaceThreshold = Value(12222);
constexpr Value NNUEThreshold = Value(500); constexpr Value NNUEThreshold = Value(520);
// KingAttackWeights[PieceType] contains king attack weights by piece type // KingAttackWeights[PieceType] contains king attack weights by piece type
constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 81, 52, 44, 10 }; constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 81, 52, 44, 10 };
@@ -346,7 +346,8 @@ namespace {
{ {
// Bonus if the piece is on an outpost square or can reach one // Bonus if the piece is on an outpost square or can reach one
// Reduced bonus for knights (BadOutpost) if few relevant targets // Reduced bonus for knights (BadOutpost) if few relevant targets
bb = OutpostRanks & attackedBy[Us][PAWN] & ~pe->pawn_attacks_span(Them); bb = OutpostRanks & (attackedBy[Us][PAWN] | shift<Down>(pos.pieces(PAWN)))
& ~pe->pawn_attacks_span(Them);
Bitboard targets = pos.pieces(Them) & ~pos.pieces(PAWN); Bitboard targets = pos.pieces(Them) & ~pos.pieces(PAWN);
if ( Pt == KNIGHT if ( Pt == KNIGHT
@@ -939,10 +940,9 @@ Value Eval::evaluate(const Position& pos) {
if (Eval::useNNUE) if (Eval::useNNUE)
{ {
Value balance = pos.non_pawn_material(WHITE) - pos.non_pawn_material(BLACK); Value v = eg_value(pos.psq_score());
balance += 200 * (pos.count<PAWN>(WHITE) - pos.count<PAWN>(BLACK));
// Take NNUE eval only on balanced positions // Take NNUE eval only on balanced positions
if (abs(balance) < NNUEThreshold) if (abs(v) < NNUEThreshold)
return NNUE::evaluate(pos) + Tempo; return NNUE::evaluate(pos) + Tempo;
} }
return Evaluation<NO_TRACE>(pos).value(); return Evaluation<NO_TRACE>(pos).value();
+8 -2
View File
@@ -816,7 +816,7 @@ namespace {
// Step 8. Futility pruning: child node (~50 Elo) // Step 8. Futility pruning: child node (~50 Elo)
if ( !PvNode if ( !PvNode
&& depth < 6 && depth < 8
&& eval - futility_margin(depth, improving) >= beta && eval - futility_margin(depth, improving) >= beta
&& eval < VALUE_KNOWN_WIN) // Do not return unproven wins && eval < VALUE_KNOWN_WIN) // Do not return unproven wins
return eval; return eval;
@@ -1028,7 +1028,7 @@ moves_loop: // When in check, search starts from here
continue; continue;
// Futility pruning: parent node (~5 Elo) // Futility pruning: parent node (~5 Elo)
if ( lmrDepth < 6 if ( lmrDepth < 8
&& !ss->inCheck && !ss->inCheck
&& ss->staticEval + 284 + 188 * lmrDepth <= alpha && ss->staticEval + 284 + 188 * lmrDepth <= alpha
&& (*contHist[0])[movedPiece][to_sq(move)] && (*contHist[0])[movedPiece][to_sq(move)]
@@ -1135,6 +1135,12 @@ moves_loop: // When in check, search starts from here
if (type_of(move) == CASTLING) if (type_of(move) == CASTLING)
extension = 1; extension = 1;
// Late irreversible move extension
if ( move == ttMove
&& pos.rule50_count() > 80
&& (captureOrPromotion || type_of(movedPiece) == PAWN))
extension = 2;
// Add extension to new depth // Add extension to new depth
newDepth += extension; newDepth += extension;