Discussion of chess software programming and technical issues.
Moderators: hgm, Dann Corbit, Harvey Williamson
Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
-
tomitank
- Posts: 237
- Joined: Sat Mar 04, 2017 11:24 am
- Location: Hungary
Post
by tomitank » Wed Aug 09, 2017 2:57 pm
Hi!
Senpai and Fruit set the fifty move counter = 0 before null move and copy from history after null move.
Code: Select all
void move_null() {
//..........
p_copy.moves = 0; // HACK: conversion
//..........
}
So not detecting draw.
Code: Select all
for (int i = 4; i < p_copy.moves; i += 2) {
if (p_stack[p_sp - i].copy.key == key) {
return true;
}
}
Stockfish and Sungorus increase the fifty move counter by 1 before null move and decrease after null move.
Code: Select all
void Position::do_null_move(StateInfo& newSt) {
//..........
++st->rule50;
//...........
}
Code: Select all
for (int i = 2, e = std::min(st->rule50, st->pliesFromNull); i <= e; i += 2)
{
stp = stp->previous->previous;
if (stp->key == st->key)
return true; // Draw at first repetition
}
Which one is correct?
I think stockfish and sungorus good, but then "Senpai" is wrong?
Apropo: I do not see this in many engines.
-Tamas
-
Robert Pope
- Posts: 523
- Joined: Sat Mar 25, 2006 7:27 pm
Post
by Robert Pope » Wed Aug 09, 2017 3:30 pm
Personally, I don't think it makes a lot of sense to zero it with a null move. You haven't done something irreversible like capturing a piece.
However, since null-moves aren't legal and won't happen in the game, I think it just comes down to which gives better results in matches.
-
syzygy
- Posts: 4891
- Joined: Tue Feb 28, 2012 10:56 pm
Post
by syzygy » Wed Aug 09, 2017 5:20 pm
Robert Pope wrote:However, since null-moves aren't legal and won't happen in the game, I think it just comes down to which gives better results in matches.
I fully agree.
The Stockfish approach makes the most sense to me:
- do not detect draw-by-repetiion across a nullmove, but
- do detect draw by 50-move rule if no progress is being made even if the current branch includes nullmoves.
But, as already stated, what is best depends on how well it works in real games.
-
hgm
- Posts: 25544
- Joined: Fri Mar 10, 2006 9:06 am
- Location: Amsterdam
- Full name: H G Muller
-
Contact:
Post
by hgm » Wed Aug 09, 2017 7:54 pm
I guess the resetting of the 50-move counter on null move was originally done in engines where this counter also decided how far back in the move history it looks for repetitions. With normal moves you cannot repeat positions from before the last irreversible move. Resetting the counter on null move was just a kludge to use this mechanism for ignoring null-move-spanning repeats. It was not really intended to fool the engine into thinking it could dodge 50-move draws by null-moving.