1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Fix assert with very high score position

In case of a very high material score, we can
overflow VALUE_INFINITE.

This patch fixes an assert with:

position fen 7k/QQQQR3/2B5/4KN1Q/3QQ3/8/8/4R3 b - - 0 1
go depth 1

No functional change.

Resolves #546
This commit is contained in:
Marco Costalba 2015-12-28 13:14:49 +01:00 committed by Joona Kiiski
parent a5c76d69c3
commit 3e4fed3a91

View file

@ -163,7 +163,7 @@ Value Endgame<KXK>::operator()(const Position& pos) const {
||(pos.count<BISHOP>(strongSide) && pos.count<KNIGHT>(strongSide)) ||(pos.count<BISHOP>(strongSide) && pos.count<KNIGHT>(strongSide))
||(pos.count<BISHOP>(strongSide) > 1 && opposite_colors(pos.squares<BISHOP>(strongSide)[0], ||(pos.count<BISHOP>(strongSide) > 1 && opposite_colors(pos.squares<BISHOP>(strongSide)[0],
pos.squares<BISHOP>(strongSide)[1]))) pos.squares<BISHOP>(strongSide)[1])))
result += VALUE_KNOWN_WIN; result = std::min(result + VALUE_KNOWN_WIN, VALUE_MATE_IN_MAX_PLY - 1);
return strongSide == pos.side_to_move() ? result : -result; return strongSide == pos.side_to_move() ? result : -result;
} }