From 9350d0dce5190fc88b4770ece79299c6d3edd2ed Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sat, 29 Mar 2014 11:12:37 +0100 Subject: [PATCH] Raise VALUE_INFINITE In some legal positions like this one: R6R/3Q4/1Q4Q1/4Q3/2Q4Q/Q4Q2/Np1Q4/kB1N1KB1 b -- 0 1 We can have a very high score, in this case 30177 and 29267 for midgame and endgame respectively, and because VALUE_INFINITE = 30001 we have an assert in interpolate() Midgame and endgame scores are stored in 16 bit signed integers so we can rise VALUE_INFINITE a little bit. This does not fix the possibility of overflow in general case, just makes the condition more difficult to trigger and anyhow better uses all the score width. Raising VALUE_INFINITE to 32000 seems to fix the problem for this particular case. No functional change. --- src/types.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/types.h b/src/types.h index 5a80402d..ea52fe6c 100644 --- a/src/types.h +++ b/src/types.h @@ -165,9 +165,9 @@ enum Value { VALUE_ZERO = 0, VALUE_DRAW = 0, VALUE_KNOWN_WIN = 10000, - VALUE_MATE = 30000, - VALUE_INFINITE = 30001, - VALUE_NONE = 30002, + VALUE_MATE = 32000, + VALUE_INFINITE = 32001, + VALUE_NONE = 32002, VALUE_MATE_IN_MAX_PLY = VALUE_MATE - MAX_PLY, VALUE_MATED_IN_MAX_PLY = -VALUE_MATE + MAX_PLY, -- 2.39.5