]> git.sesse.net Git - stockfish/commit
Tablebases root ranking
authorsyzygy1 <3028851+syzygy1@users.noreply.github.com>
Wed, 18 Apr 2018 16:38:38 +0000 (18:38 +0200)
committerStéphane Nicolet <cassio@free.fr>
Wed, 18 Apr 2018 16:46:24 +0000 (18:46 +0200)
commit108f0da4d7f993732aa2e854b8f3fa8ca6d3b46c
treea1a6ef2500a3339c07f03a2d9b0bca9173c94279
parente9aeaad05266ca557a9496b5a17b4c5f82f0e946
Tablebases root ranking

This patch corrects both MultiPV behaviour and "go searchmoves" behaviour
for tablebases.

We change the logic of table base probing at root positions from filtering
to ranking. The ranking code is much more straightforward than the current
filtering code (this is a simplification), and also more versatile.

If the root is a TB position, each root move is probed and assigned a TB score
and a TB rank. The TB score is the Value to be displayed to the user for that
move (unless the search finds a mate score), while the TB rank determines which
moves should appear higher in a multi-pv search. In game play, the engine will
always pick a move with the highest rank.

Ranks run from -1000 to +1000:

901 to 1000   : TB win
900           : normally a TB win, in rare cases this could be a draw
1 to 899      : cursed TB wins
0             : draw
-1 to -899    : blessed TB losses
-900          : normally a TB loss, in rare cases this could be a draw
-901 to -1000 : TB loss

Normally all winning moves get rank 1000 (to let the search pick the best
among them). The exception is if there has been a first repetition. In that
case, moves are ranked strictly by DTZ so that the engine will play a move
that lowers DTZ (and therefore cannot repeat the position a second time).

Losing moves get rank -1000 unless they have relatively high DTZ, meaning
they have some drawing chances. Those get ranks towards -901 (when they
cross -900 the draw is certain).

Closes https://github.com/official-stockfish/Stockfish/pull/1467

No functional change (without tablebases).
src/position.cpp
src/position.h
src/search.cpp
src/search.h
src/syzygy/tbprobe.cpp
src/syzygy/tbprobe.h
src/thread.cpp
src/thread.h