flok wrote: βFri Sep 26, 2025 10:51 pm
syzygy wrote: βFri Sep 26, 2025 10:05 pm
flok wrote: βFri Sep 26, 2025 9:22 pmWhat I do in the main search: I check if there are 5 (depending on the tb size) pieces on the board or less for the current position and then use tb_probe_wdl() to return max_eval for win etc.
I assume you probe them in the search (immediately after a capture into a 5-men position), not in the eval.
Oh! I checked it in every search-node (not qs).
Effectively it should be the same, assuming you always take the cutoff if the TB probe is successful. The only way to get from more than 6 to 5 pieces is by a capture. So if it is quicker to check that the number of pieces is <= 5 than first checking whether the previous move was a capture, then just directly check the number of pieces.
You should not return max_eval but treat it like you treat mate, i.e. correct for the distance to the root. Just pick a TB_WIN value that is below your positive "mate in x" values.
E.g. if mate-in-1 is 31999, then TB_WIN-in-1 could be 31499, leaving enough room for all reasonable mate-in-x scores.
Ah I did that different indeed. I thought I should do max_eval - tree_height.
It seems you do this:
Code: Select all
int score = syzygy_score.value();
if (score < 0)
score -= -max_eval + csd;
else if (score > 0)
score = max_eval - csd;
return score;
Is syzygy_score.value() one of -1,0,1? (Or one of -2,-1,0,1,2, with -1/1 being 50-move draws?)
Why do you substract -max_eval, i.e add a huge value, if the position is a loss?
I guess "-=" should be "=".
Earlier you set csd = max_depth - depth. But depth is the depth of the current search iteration, so you are assigning the same winning positions with the same distance to the root different values in different search iterations. That is "wrong".
And it seems your code for dealing with mates is the same, so also wrong.
I would suggest you watch or inspect some games to see if what the engine does makes any sense.
Oh what I did was at the root of the tree (before checking the first moves) check what the best moves are and then just pick the win/draw with the shortest distance.
That is fine for a start (it will win the games that are won, provided you deal correctly with zeroing moves!!), but it leads to very ugly play. With DTZ-optimal play in KQBNvK, white will force black to takes its queen if that is the fastest way to a zeroing move. This can most easily be avoided by doing a short search on those moves that preserve the win.