Skip to content

Commit d926b89

Browse files
committed
Merge remote-tracking branch 'official-stockfish/master'
2 parents 613dc66 + 68fbb1e commit d926b89

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/evaluate.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,11 @@ Value Eval::evaluate(const Position& pos) {
796796
sf = ei.pi->pawn_span(strongSide) ? ScaleFactor(56) : ScaleFactor(38);
797797
}
798798

799+
// Scale endgame by number of pawns
800+
int p = pos.count<PAWN>(WHITE) + pos.count<PAWN>(BLACK);
801+
int v_eg = 1 + abs(int(eg_value(score)));
802+
sf = ScaleFactor(std::max(sf / 2, sf - 7 * SCALE_FACTOR_NORMAL * (14 - p) / v_eg));
803+
799804
// Interpolate between a middlegame and a (scaled by 'sf') endgame score
800805
Value v = mg_value(score) * int(me->game_phase())
801806
+ eg_value(score) * int(PHASE_MIDGAME - me->game_phase()) * sf / SCALE_FACTOR_NORMAL;

src/tt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const {
7878
for (int i = 0; i < ClusterSize; ++i)
7979
if (!tte[i].key16 || tte[i].key16 == key16)
8080
{
81-
if (tte[i].key16)
81+
if ((tte[i].genBound8 & 0xFC) != generation8 && tte[i].key16)
8282
tte[i].genBound8 = uint8_t(generation8 | tte[i].bound()); // Refresh
8383

8484
return found = (bool)tte[i].key16, &tte[i];

src/tt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct TTEntry {
5050
// Don't overwrite more valuable entries
5151
if ( (k >> 48) != key16
5252
|| d > depth8 - 2
53-
|| g != (genBound8 & 0xFC)
53+
/* || g != (genBound8 & 0xFC) // Any matching keys are already refreshed by probe() */
5454
|| b == BOUND_EXACT)
5555
{
5656
key16 = (uint16_t)(k >> 48);

0 commit comments

Comments
 (0)