mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Partially restore HistoryMax
Should be not useful but better safe than sorry. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
13a42284b6
commit
877b468e3e
2 changed files with 6 additions and 8 deletions
|
@ -45,6 +45,8 @@ public:
|
||||||
Value gain(Piece p, Square to) const;
|
Value gain(Piece p, Square to) const;
|
||||||
void update_gain(Piece p, Square to, Value delta);
|
void update_gain(Piece p, Square to, Value delta);
|
||||||
|
|
||||||
|
static const int MaxValue = (1 << 29); // To avoid an overflow
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Value history[16][64]; // [piece][to_square]
|
Value history[16][64]; // [piece][to_square]
|
||||||
Value maxGains[16][64]; // [piece][to_square]
|
Value maxGains[16][64]; // [piece][to_square]
|
||||||
|
@ -60,7 +62,7 @@ inline int History::value(Piece p, Square to) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void History::update(Piece p, Square to, Value bonus) {
|
inline void History::update(Piece p, Square to, Value bonus) {
|
||||||
history[p][to] += bonus;
|
if (abs(history[p][to]) < MaxValue) history[p][to] += bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Value History::gain(Piece p, Square to) const {
|
inline Value History::gain(Piece p, Square to) const {
|
||||||
|
@ -68,11 +70,7 @@ inline Value History::gain(Piece p, Square to) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void History::update_gain(Piece p, Square to, Value gain) {
|
inline void History::update_gain(Piece p, Square to, Value gain) {
|
||||||
|
maxGains[p][to] = (gain >= maxGains[p][to] ? gain : maxGains[p][to] - 1);
|
||||||
if (gain >= maxGains[p][to])
|
|
||||||
maxGains[p][to] = gain;
|
|
||||||
else
|
|
||||||
maxGains[p][to]--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !defined(HISTORY_H_INCLUDED)
|
#endif // !defined(HISTORY_H_INCLUDED)
|
||||||
|
|
|
@ -247,10 +247,10 @@ void MovePicker::score_evasions() {
|
||||||
{
|
{
|
||||||
m = cur->move;
|
m = cur->move;
|
||||||
if ((seeScore = pos.see_sign(m)) < 0)
|
if ((seeScore = pos.see_sign(m)) < 0)
|
||||||
cur->score = seeScore - (1 << 29); // Be sure are at the bottom
|
cur->score = seeScore - History::MaxValue; // Be sure we are at the bottom
|
||||||
else if (pos.move_is_capture(m))
|
else if (pos.move_is_capture(m))
|
||||||
cur->score = pos.midgame_value_of_piece_on(move_to(m))
|
cur->score = pos.midgame_value_of_piece_on(move_to(m))
|
||||||
- pos.type_of_piece_on(move_from(m)) + (1 << 29);
|
- pos.type_of_piece_on(move_from(m)) + History::MaxValue;
|
||||||
else
|
else
|
||||||
cur->score = H.value(pos.piece_on(move_from(m)), move_to(m));
|
cur->score = H.value(pos.piece_on(move_from(m)), move_to(m));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue