FIDE Rules

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

FIDE Rules

Postby crystalclear » 11 Dec 2012, 19:33

9.2 The game is drawn, upon a correct claim by the player having the move, when the same position, for at least the third time (not necessarily by a repetition of moves)

a) is about to appear, if he first writes his move on his scoresheet and declares to the arbiter his intention to make this move, or
b) has just appeared, and the player claiming the draw has the move.


Positions as in (a) and (b) are considered the same, if the same player has the move, pieces of the same kind and color occupy the same squares, and the possible moves of all the pieces of both players are the same. Positions are not the same if a pawn that could have been captured en passant can no longer in this manner be captured or if the right to castle has been changed temporarily or permanently.



Am I missing something?
I don't see how two similar looking positions can have castling rights that are temporarily different.
Permanent yes, eg a rook moves and then moves back.
But temporarily? I just dont see it.
crystalclear
 
Posts: 91
Joined: 22 Sep 2011, 14:19

Re: FIDE Rules

Postby crystalclear » 14 Dec 2012, 02:01

Perhaps I should explain myself a little. I am looking at this in relation to implementing repetition detection in my program.

I have some repetition detection software and it seems to detect when a position is repeated during the search and if it finds a repeat, it returns zero. Nevertheless, my program - for reasons I don't understand - will too often draw a game by repetition when it is ahead by a significant margin.

I can understand it happening sometimes, for example if it has a large material advantage but spots a mate threat against the program and repetition is the only way to avoid teh checkmate. But it seems to happen too often and in situations where there is no obvious need for repetition. So I looked at the rules for guidance, and I am a little confused by the text about a temporary change in castling rights. In my terminology, castling rights can only be lost and never gained: if you temporarily cannot castle because you are in check, would castle through check, or into check, or if a square between king and rook is occupied, I don't call that as a loss of castling rights. I refer to it as inability to castle despite possibly having castling rights.

Now if you are unable to castle, my thinking is that you will also be unable to castle in similar looking positions: same pieces on same squares.

=

I am uncomfortable with the whole scenario of position repetition in chess programs.
It seems to me that there is nothing in the UCI specification to handle claiming a draw by repetition.
At least one GUI seems to think that a game is drawn if the same position occurs three times. However the FIDE rules are that my program should be able to claim a draw (for example if the score is negative five pawns and the game looks lost) or not claim a draw (for example if deeper search has begun to reveal a promising looking move that had previously not looked so good and the score is now positive five pawns).

Another thing that makes me uncomfortable with draw-by-repetition is an article I read on graph history interaction, which makes me worry whether draw scores propagated up through the search function should be stored in the transposition tables conditionally or unconditionally and what search depth I should store.

If a position has occurred twice in a game, with the opponent to move, then when my search encounters the position it would be the third occurence in the game and the opponent should have the option of claiming a draw. So if things worked properly my program would be treating the possibility of a draw claim by somehow putting a lower bound of zero on the position's score and searching further to see what could happen from there.

What I think would happen in practice is that my program as it is now would recognize the repeated position and just score it as zero without further investigation.
If the position then arose in the game, the GUI would gazump my opponent and stop the game and report it as a draw, even if the opponent wanted to play on.

Everything seems wrong:
my program cannot claim a draw,
my program treats repetition as zero rather than a lower bound,
the GUI assumes draws on repetition,
my program reacts to the second occurence of a position and not really the third.

Reacting to the second occurence is maybe a good thing to do in a search, but in the rules, it is the third occurence that is important. I guess that needs some sort of careful coding. I have seen one very good chess engine - stockfish, Houdini, or something similar - that couldn't find a good move which existed because it required the game to pass through a position that had already occurred. It must have been scoring the position as zero each time it encountered it, and it was incapable of seeing a win which required the game to pass through a previous position and play a winning move instead of a drawing move that had been played earlier in the game.

=

One last note on repetition.

I saw a game played in Gibraltar 2012 where an English player called Howell could draw the game by repetition quite easily, but he was playing for a win.
He would play from a position and manouver himself into a second repetition of that position. Then he advanced the game a little and repeated that new position.
The process allowed him to increase the number of moves in the game and thus reach a time control point without running into time control problems.
I remember thinking to myself that there probably isn't a single computer chess program in existence that could have played like that.

Humans seem to sometimes use a first repetition to test whether their opponent is happy with a draw. It could be that deviation from the repetition moves by the opponent gives you a bigger advantage than deviating yourself. So even if you don't want a position to occur three times, it can be worthwhile having it occur twice.
crystalclear
 
Posts: 91
Joined: 22 Sep 2011, 14:19

Re: FIDE Rules

Postby wgarvin » 26 Mar 2013, 07:37

Just a wild guess:

"temporarily" might refer to situations where you haven't moved the king or rook yet, but you are currently unable to castle there because a square is under attack. So castling to that side is currently not possible even if you haven't permanently lost the right to castle to that side.

If this is in fact what it means, then most chess engines probably implement it wrong (treating two positions as different when one has the permanent right and the other doesn't, even if the piece positions, stm and set of LEGAL moves is in fact the same). IOW, the rule might imply that if the castling move is not currently legal then you have _temporarily_ lost the castling right and for purposes of deciding if a position is a repeat this is equivalent to a position where the right has been permanently lost.

If true, it means a castling right should only be included in the zobrist key for side to move, if that castling move is currently LEGAL. I think ep square is already treated that way by most engines.

Its hard to imagine a situation where doing this wrong would hurt the engine's play though.
wgarvin
 
Posts: 2
Joined: 22 Oct 2008, 19:54
Location: Montreal, Canada

Re: FIDE Rules

Postby crystalclear » 26 Aug 2013, 04:16

Okay, I get it; thanks.

So if white has kingside castling priveledges but the opponent attacks g1, and white plays

Kf1 ... Ke1 ... Kf1 ... Ke1 (and black repeats too)

Then this is 3 fold repetition of the similar looking positions with the King on e1.
The first (before any King moves) was with (long term) castling rights but the castling move temporarily disallowed due to castling into check
The second and third (after Ke1 moves) are without castling rights due to the king having moved.

As you said, my software as it stands will not handle that correctly. It is an ugly little thing that I might just ignore.

My confusion arose from the terminology I use. I would say that you have castling rights until the king or rook has moved, you are just unable to castle into or through check.
FIDE's terminology seems to be that the castling rights are temporarily suspended. I would previously have said that you have the right to castle, but not the ability to do it.

I find the whole idea of "same position" a little unsettling. For example a position might be lost due to the opponent having the ability to force checkmate, and a similar position (same pieces on the same squares - different non-reversable move count) might allow you to force a draw due to the 50 move rule. So you could make 1/2 a point of demonstrable progress with an opponent low on time and he can still claim a draw, even though you have effectively proven the opponent didn't know how to play the position.

The lost position and the drawn position can be counted as repetition of "the same position". That is odd!
crystalclear
 
Posts: 91
Joined: 22 Sep 2011, 14:19


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 24 guests