Perpetual check bug

Code, algorithms, languages, construction...

Perpetual check bug

Postby kickstone » Mon Jan 02, 2017 8:25 pm

I recently changed the way i recognize repetition of position draws within the search. The search starts with the actual game history and any time a position is repeated a draw score is immediately returned. In the following position:

5rk1/p2R1p1p/1p2p1pQ/1P6/P3q1P1/7P/2r3P1/5R1K w - - 0 1

It finds the drawing move 1. h6xf8+ but after the sequence of moves 1...g8xf8, 2. f1xf7+ f8-e8, 3. f7-e7+ e8-f8, 4. e7-f7+ f8-g8, 5. f7-g7+ g8-f8

now it sees that playing 6. g7-e7 repeats a previous position and thinks its a draw. Instead its not check and he's let black of the hook. Black then wins easily.

I suppose if i generated checks before the other quiet moves this may not have happened. But thats not what i currently do. Is this just a rare case thats the cost of being able to see these repetitions quickly in the search or is there something else people do to avoid this situation. It does;t seem that rare.
kickstone
 
Posts: 14
Joined: Fri Feb 26, 2016 7:27 am

Re: Perpetual check bug

Postby H.G.Muller » Tue Jan 03, 2017 9:48 am

You detect a false repetition, because you ignore the side to move. The position after 6. g7-e7 is NOT a repeat, because it leaves black to move, while after 3... Kf8 white was to move.
H.G.Muller
 
Posts: 169
Joined: Sun Jul 14, 2013 10:00 am

Re: Perpetual check bug

Postby kickstone » Tue Jan 03, 2017 7:51 pm

You are absolutely correct. Before i changed to returning a draw score on first repetition within the search, I was checking for a second repetition. In which case side to move is irrelevant. I haven't implemented Transposition tables yet so i'm not hashing my positions yet which would include side to move. So for now i will loop through every other move in the history to detect repetitions. It works very well now. Not only can i detect deep repetitions in the search but the engine stops making shuffling moves even when ahead. Thanks Harm!
kickstone
 
Posts: 14
Joined: Fri Feb 26, 2016 7:27 am


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 1 guest

cron