TalkChess.com
Hosted by Your Move Chess & Games

Author Message
Robert Hyatt

Joined: 27 Feb 2006
Posts: 20340
Location: Birmingham, AL

Post subject: Re: Syzygy and draw by repetition    Posted: Fri Jul 22, 2016 10:00 pm

syzygy wrote:
 bob wrote: I gave this a quick look. Do you do anything regarding repetitions in your code where you probe the EGTBs? IE I assume you are probably calling tb_probe_root()? In looking at that code, repetitions are ignored, which I presume means you need to do that check for yourself and avoid moves that lead to a 3-fold rep.

I'm not sure which we are looking at now (that in Arasan?), but my example code has this:
 Code: if (dtz > 0) { // winning (or 50-move rule draw)     int best = 0xffff;     for (size_t i = 0; i < Search::RootMoves.size(); i++) {       int v = Search::RootMoves[i].score;       if (v > 0 && v < best)    best = v;     }     int max = best;     // If the current phase has not seen repetitions, then try all moves     // that stay safely within the 50-move budget, if there are any.     if (!has_repeated(st.previous) && best + cnt50 <= 99)       max = 99 - cnt50;     for (size_t i = 0; i < Search::RootMoves.size(); i++) {       int v = Search::RootMoves[i].score;       if (v > 0 && v <= max)    Search::RootMoves[j++] = Search::RootMoves[i];     }   }

If the current "phase" (since the last pawn move or capture) has seen a repetition (on the board), then "max" remains equal to "best" and only those root moves are selected that are "best" in terms of DTZ. ("max" should be understood as the maximum DTZ value allowed.)

Ah, we are probably looking at the Fathom library. The probe_root() function of that library seems not to check for repetitions.

 Quote: I have added syzygy to Crafty, but have not yet looked at this specific issue. In looking, it looks like this check needs to be added into tb_probe_root() since it returns the suggested best move, without any consideration for repetitions (it does use the 50 move counter, obviously)...

If the root postiion is a TB win, then root_probe() returns the moves that win within the 50-move rule. The exception is if one repetition has occurred, because then it should be avoided that the same position is repeated again. (By playing the optimal DTZ moves until the next capture or pawn move, it is certain that DTZ decreases on every move, so that it is impossible that earlier positions are repeated.)

Many variations are of course possible.

 Quote: In looking at this further, I am not quite sure what is going on, as once you reach a 5 piece ending, I can see no valid reason that Ronald's code would return a move that repeats the position the first time, much less the second.

So a first repetition is not excluded.

 Quote: I can't get Crafty to play the same moves in normal game-playing mode. IE if I reset to move 80 and play Qd5+, I get an instant Kf6 from the syzygy probe code, not Kf8... I would expect the same moves considering DTZ and WDL are both available.

https://syzygy-tables.info/?fen=8/5k2/8/3Q4/8/7K/1p3q2/8_b_-_-_0_1

Both Ke7 and Kf6 are optimal in this position. Ke8/Kf8/Kg7 also win, but lead to a somewhat higher DTZ (and could therefore repeat the position, either immediately or some moves later).

Note that simply refusing to play repeating moves is not a solution. If an earlier move increased DTZ, it is possible that the engine is forced to repeat the position later in order to return to a lower DTZ.

In positions like these DTZ is rather high and it is fairly certain that the DTZ-optimal move is also a very sane-looking move. If DTZ is much lower, then the DTZ-optimal move might look much less sane.

So somehow Arasan played a sub-optimal move (Kf8) (which looks wrong to me as a human as if the king stays on the edge, it will get checked forever anyway.

Crafty immediately spits out Kf6 in the position, where Arasan played Kf8 for unknown reasons...

I've not seen any issues at all other than I had to carefully handle the case where the mate is delivered on move 50 (both sides have played exactly 50 reversible moves, but the last move delivered mate which takes precedence).

Seems to be working just fine for me, so far.

BTW, I have no requirement that "the move looks sane." I have been seeing nonsensical moves for almost 50 years now. It got a bit worse when I switched to Steven's 4 (and a few 5) piece files and then Nalimov, and then when we started to use 6's, it became more irrational looking. But computers play strangely anyway, and the goal is to win for me. Wasting time and effort trying to somehow "make the computer more human-like" seems pointless since humans can't announce mates in these positions anyway.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
Subject Author Date/Time
Jon Dart Fri Jul 22, 2016 4:41 pm
Robert Hyatt Fri Jul 22, 2016 5:18 pm
Jon Dart Fri Jul 22, 2016 5:43 pm
Ronald de Man Fri Jul 22, 2016 8:50 pm
Robert Hyatt Fri Jul 22, 2016 9:56 pm
Ronald de Man Sat Jul 23, 2016 12:15 am
Basil Falcinelli Sat Jul 23, 2016 10:05 am
Jon Dart Sat Jul 23, 2016 10:16 pm
Basil Falcinelli Sun Jul 24, 2016 3:34 pm
Ronald de Man Fri Jul 22, 2016 8:42 pm
Re: Syzygy and draw by repetition Robert Hyatt Fri Jul 22, 2016 10:00 pm
Greg Simpson Fri Jul 22, 2016 11:19 pm
Dann Corbit Fri Jul 22, 2016 11:36 pm
Robert Hyatt Fri Jul 22, 2016 11:49 pm
J. Wesley Cleveland Sat Jul 23, 2016 12:08 am
Ronald de Man Sat Jul 23, 2016 12:24 am
Kevin Hearn Sat Jul 23, 2016 12:27 am
Arpad Rusz Sat Jul 23, 2016 8:59 am
H.G.Muller Sat Jul 23, 2016 10:19 am
Ronald de Man Sat Jul 23, 2016 11:16 am
H.G.Muller Sat Jul 23, 2016 12:09 pm
Ronald de Man Sat Jul 23, 2016 12:23 pm
H.G.Muller Sat Jul 23, 2016 12:49 pm
Ronald de Man Sat Jul 23, 2016 1:49 pm
Jon Dart Fri Jul 22, 2016 10:15 pm
Robert Hyatt Fri Jul 22, 2016 11:48 pm
J. Wesley Cleveland Sun Jul 24, 2016 1:30 am
Greg Simpson Sun Jul 24, 2016 2:21 am
Ronald de Man Sun Jul 24, 2016 2:43 am
Greg Simpson Sun Jul 24, 2016 3:00 am
Jon Dart Sun Jul 24, 2016 9:52 pm
Ronald de Man Sun Jul 24, 2016 10:12 pm
Jon Dart Sun Jul 24, 2016 11:23 pm
Michel Van den Bergh Mon Jul 25, 2016 6:06 am
Kevin Hearn Mon Jul 25, 2016 7:26 am
Michel Van den Bergh Mon Jul 25, 2016 9:21 am
J. Wesley Cleveland Mon Jul 25, 2016 5:33 pm
Kevin Hearn Mon Jul 25, 2016 6:58 pm
Greg Simpson Mon Jul 25, 2016 7:09 pm

 Jump to: Select a forum Computer Chess Club Forums----------------Computer Chess Club: General TopicsComputer Chess Club: Tournaments and MatchesComputer Chess Club: Programming and Technical DiscussionsComputer Chess Club: Engine Origins Other Forums----------------Chess Thinkers ForumChess Players ForumForum Help and Suggestions
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group
Enhanced with Moby Threads