[Retros] Castling and repetition

Rol, Guus G.A.Rol at umcutrecht.nl
Mon Oct 29 07:26:26 EDT 2007

Absolutely correct! Of course mathematics works equally well if it takes
a similar approach. Yefim's castling right function R(KQkq)where all
arguments are binary choices is appropriate. The only realization
missing in the original post is that there are 4 different partially
(in)dependent functions related to castling:

R(KQkq) the (permanent) right to castle
O(KQkq) the opportunity (temporary right) to castle
L(KQkq) the license (composition right while not permanent right) to
P(KQkq) the possibility to castle eventually

Not one of these 4 is fully determined by the other 3. A position might
e.g have these 16 castling state values:

R(1000), O(0010), P(1110), L(0110)

This situation could arise in a composition where white retracts one
castling move and subsequently plays an arbitrary move. The retraction
proves 1 absolute unalienable castling right (if you do not apply highly
dubious "Kofman logic") while 2 other castling licenses may be mutually
exclusive castlings.

Of the 4 castling functions only "R" and "L" have legal implications,
the other 2 just analytical ones. The "O"-function does appear in the
Laws as "temporary castling right" but bears no actual weight in
deciding any legality issues. If you nevertheless allow it formally to
join the legality trio, then you get the 3 letters of my last name -
pure chance I guess :-)

Guus R O L

-----Oorspronkelijk bericht-----
Van: retros-bounces at janko.at [mailto:retros-bounces at janko.at] Namens
Francois Labelle
Verzonden: vrijdag 26 oktober 2007 7:51
Aan: The Retrograde Analysis Mailing List
Onderwerp: Re: [Retros] Castling and repetition

If Mathematics doesn't give an answer, then maybe Computer Science does!

My chess engine defines castling rights like this:

The starting position has K = Q = k = q = true; After each move do the
- if (the square h1 does not contain a white rook) K = false;
- if (the square a1 does not contain a white rook) Q = false;
- if (the square h8 does not contain a black rook) k = false;
- if (the square a8 does not contain a black rook) q = false;
- if (the white king moved) K = Q = false;
- if (the black king moved) k = q = false;

And the reason is that this is the simplest definition that gets the job
done (i.e. these four bits + the diagram + the en passant square allow
the move generator to generate exactly the set of legal moves).

Retros mailing list
Retros at janko.at

More information about the Retros mailing list