Skip to content

Commit

Permalink
Shuffle detection #2064
Browse files Browse the repository at this point in the history
Shuffle detection procedure :

Shuffling positions are detected if

    the last 36 moves are reversible (rule50_count() > 36),
    the position have been already in the TT,
    there is a still a pawn on the board (to avoid special endings like KBN vs K).

The position is then judged as a draw.

An extension is realized if we already made 14 successive reversible moves in PV to accelerate the detection of the eventual draw.

To go further : we can still improve the idea. The length of the tests need a lot of ressources.

    the limit of 36 is logic but must be checked again for special zugzwang positions,
    this limit can be decreased in special positions,
    the limit of 14 moves for extension has not been tuned.

STC
LLR: -2.94 (-2.94,2.94) [0.50,4.50]
Total: 32595 W: 7273 L: 7275 D: 18047 Elo +0.43
http://tests.stockfishchess.org/tests/view/5c90aa330ebc5925cfff1768

LTC
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 51249 W: 8807 L: 8486 D: 33956 Elo +1.85
http://tests.stockfishchess.org/tests/view/5c90b2450ebc5925cfff1800

VLTC
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 137974 W: 20503 L: 19983 D: 97488 Elo +1.05
http://tests.stockfishchess.org/tests/view/5c9243a90ebc5925cfff2a93

Bench: 3548313
  • Loading branch information
MJZ1977 authored and mcostalba committed Mar 31, 2019
1 parent c858990 commit 76f1807
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/search.cpp
Expand Up @@ -602,6 +602,15 @@ namespace {
: ttHit ? tte->move() : MOVE_NONE;
ttPv = (ttHit && tte->is_pv()) || (PvNode && depth > 4 * ONE_PLY);

// if position has been searched at higher depths and we are shuffling, return value_draw
if (pos.rule50_count() > 36
&& ss->ply > 36
&& depth < 3 * ONE_PLY
&& ttHit
&& tte->depth() > depth
&& pos.count<PAWN>() > 0)
return VALUE_DRAW;

// At non-PV nodes we check for an early TT cutoff
if ( !PvNode
&& ttHit
Expand Down Expand Up @@ -920,6 +929,10 @@ namespace {
&& (pos.blockers_for_king(~us) & from_sq(move) || pos.see_ge(move)))
extension = ONE_PLY;

// Shuffle extension
else if(pos.rule50_count() > 14 && ss->ply > 14 && depth < 3 * ONE_PLY && PvNode)
extension = ONE_PLY;

// Castling extension
else if (type_of(move) == CASTLING)
extension = ONE_PLY;
Expand Down

1 comment on commit 76f1807

@syzygy1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcostalba
@MJZ1977
The commit message is talking about moves, but what is counted are plies. So 36 is just 18 out of 50 moves. And if 36 is "logic" because 36+14=50, then the logic seems to be wrong (but I don't see the logic anyway, so maybe something else is meant).

Obviously there are many endgame positions with pawns that require more than 18 moves to win.

Please sign in to comment.