3-fold repetition

Discussion of chess software programming and technical issues.

Moderator: Ras

Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: 3-fold repetition

Post by Sven »

flok wrote:I get a lot of "3-fold repetition" endings.
What are ways to prevent this?
If you are talking about repetitions in won positions then I think there might be a bug in the repetition detection itself, since a correct search should not allow the opponent to repeat.

Another question: During search, do you consider the first repetition (= second occurrence) as a draw, or only the second repetition (= third occurrence)? The former is much better.
flok

Re: 3-fold repetition

Post by flok »

Sven Schüle wrote:
flok wrote:I get a lot of "3-fold repetition" endings.
What are ways to prevent this?
If you are talking about repetitions in won positions then I think there might be a bug in the repetition detection itself, since a correct search should not allow the opponent to repeat.
That's an interesting point. How can I prevent what the other guy does?
Another question: During search, do you consider the first repetition (= second occurrence) as a draw, or only the second repetition (= third occurrence)? The former is much better.
The fist. I have a std::unordered_map in which I store the hashes of each position. Then if there's a hit, I use a score 0 instead of doing a search().
Robert Pope
Posts: 570
Joined: Sat Mar 25, 2006 8:27 pm
Location: USA
Full name: Robert Pope

Re: 3-fold repetition

Post by Robert Pope »

flok wrote: That's an interesting point. How can I prevent what the other guy does?
If you don't make a move that is a second repeat, then your opponent can't either.
flok

Re: 3-fold repetition

Post by flok »

Robert Pope wrote:
flok wrote: That's an interesting point. How can I prevent what the other guy does?
If you don't make a move that is a second repeat, then your opponent can't either.
Ah the coin drops!
That simply means my move-to-history code must be broken in some way. Let's (=me) investigate.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: 3-fold repetition

Post by Sven »

Robert Pope wrote:
flok wrote: That's an interesting point. How can I prevent what the other guy does?
If you don't make a move that is a second repeat, then your opponent can't either.
No, I don't think that's the point. First thing is, positions are repeated, not moves. And my point was, if the (first) repetition of a position X (after 4 or more plies) is detected correctly and the side that is to move in X has a way to avoid the repetition (i.e., can play a better move that leads to a positive score) then the search should be able to find it.

Also "allowing the opponent to repeat" can mean at least two different things:
a) making a move after which my opponent can create a repetition directly with his reply, or
b) making a move after which my opponent can force me to make a move that repeats the position.
User avatar
hgm
Posts: 28499
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: 3-fold repetition

Post by hgm »

Robert Pope wrote:If you don't make a move that is a second repeat, then your opponent can't either.
Actually that is not true. We just had a case with that with Sjaak II in mini-Shogi. There the rule is that a 4-fold repeat is a loss for white. Because such a color asymmetry is not in Sjaaks configurability options, it was set to think any (first) repeat would lose for the player causing the repeat. The idea was that this would then always avoid the loss with white, but perhaps sometimes (against an opponent that did not know the rules) would fail to collect a win by repetition when it played black.

But that was not the case. Sjaak was playing white avoiding all repetitions with its own move. But the opponent, who was aware that black would win on repetition, nevertheless was able to visit the same position 4 times, reaching it from 4 different positions. Sjaak of course had seen that the opponent could repeat, but thought that would be losing for himthe latter, and thus was not afraid to offer the opportunity to do so.