X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmovepick.h;h=ee7cf4a445dd257cc39160fd135a53f85e1ac23e;hb=b258b4fee789680566bff973cd6f45dc5d24b365;hp=c19141820e3397804580a06fbc8b02df12e5e7a0;hpb=352bd6f5aa348e15909f50266fc5bdc003df35bf;p=stockfish diff --git a/src/movepick.h b/src/movepick.h index c1914182..ee7cf4a4 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -42,7 +42,11 @@ struct HistoryStats { Square from = from_sq(m); Square to = to_sq(m); - table[c][from][to] -= table[c][from][to] * abs(int(v)) / 324; + const int denom = 324; + + assert(abs(int(v)) <= denom); // Needed for stability. + + table[c][from][to] -= table[c][from][to] * abs(int(v)) / denom; table[c][from][to] += int(v) * 32; } @@ -65,7 +69,11 @@ struct Stats { void update(Piece pc, Square to, Move m) { table[pc][to] = m; } void update(Piece pc, Square to, Value v) { - table[pc][to] -= table[pc][to] * abs(int(v)) / 936; + const int denom = 936; + + assert(abs(int(v)) <= denom); // Needed for stability. + + table[pc][to] -= table[pc][to] * abs(int(v)) / denom; table[pc][to] += int(v) * 32; }