diff --git a/src/evaluate.cpp b/src/evaluate.cpp index d533eed8..35764b71 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -706,9 +706,9 @@ namespace { // ...count safe + (behind & safe) with a single popcount int bonus = popcount((Us == WHITE ? safe << 32 : safe >> 32) | (behind & safe)); bonus = std::min(16, bonus); - int weight = pos.count(Us); + int weight = pos.count(Us) - 2 * ei.pi->open_files(); - return make_score(bonus * weight * weight / 22, 0); + return make_score(bonus * weight * weight / 18, 0); } diff --git a/src/pawns.cpp b/src/pawns.cpp index 72496fcc..b83b780a 100644 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@ -215,6 +215,7 @@ Entry* probe(const Position& pos) { e->key = key; e->score = evaluate(pos, e) - evaluate(pos, e); e->asymmetry = popcount(e->semiopenFiles[WHITE] ^ e->semiopenFiles[BLACK]); + e->openFiles = popcount(e->semiopenFiles[WHITE] & e->semiopenFiles[BLACK]); return e; } diff --git a/src/pawns.h b/src/pawns.h index 24843e30..e26ae67e 100644 --- a/src/pawns.h +++ b/src/pawns.h @@ -38,6 +38,7 @@ struct Entry { Bitboard passed_pawns(Color c) const { return passedPawns[c]; } Bitboard pawn_attacks_span(Color c) const { return pawnAttacksSpan[c]; } int pawn_asymmetry() const { return asymmetry; } + int open_files() const { return openFiles; } int semiopen_file(Color c, File f) const { return semiopenFiles[c] & (1 << f); @@ -74,6 +75,7 @@ struct Entry { int semiopenFiles[COLOR_NB]; int pawnsOnSquares[COLOR_NB][COLOR_NB]; // [color][light/dark squares] int asymmetry; + int openFiles; }; typedef HashTable Table;