unclear 960 position regarding castling

Discussion of chess software programming and technical issues.

Moderator: Ras

ericlangedijk
Posts: 68
Joined: Thu Aug 08, 2013 5:13 pm

unclear 960 position regarding castling

Post by ericlangedijk »

[d]r2q3r/pp3pk1/2n1bbP1/3pN3/3P4/1BN4P/PP1Q1P2/R3R1K1 b Q -

In some datset I encounter this position indicating white can long castle. So must be chess960.
(there is also a pv included going: pv h8h6 e5g4 h6h3 e1e6 f7e6 g1a1 c6d4 b3d5 e6d5 g4f6).

Is there any consensus about which rook is the castling rook?
Both rooks could have moved. Both rooks could be the "castling" rook.

(I know this "Q" should actually be an "A" but anyway... what to do as a programmer)
User avatar
Tibono
Posts: 174
Joined: Sat Aug 01, 2015 6:16 pm
Location: France
Full name: Eric Bonneau

Re: unclear 960 position regarding castling

Post by Tibono »

If I understand correctly the rules, e1-Rook cannot be involved in a castling move. Because the King must be placed between both rooks in the starting position, hence either the King or the e1-Rook moved. If the King moved, any castling is ruled out. If e1-Rook moved, and King didn't, then a1-Rook is a candidate, assuming it didn't move so far. Castling also requires there is no piece in-between, hence the PV is including e1e6 Rook move.
Hope this helps...
mar
Posts: 2688
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: unclear 960 position regarding castling

Post by mar »

Tibono is right - white cannot possibly castle here, no matter if FRC or standard chess => the FEN has invalid castling rights
btw KQ is perfectly valid in X-FEN notation in Chess960, rook letters are used in S-FEN
Aleks Peshkov
Posts: 994
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia
Full name: Aleks Peshkov

Re: unclear 960 position regarding castling

Post by Aleks Peshkov »

https://en.wikipedia.org/wiki/X-FEN
the castling rights provided by this as default are related to the outermost rook of the affected side
ericlangedijk
Posts: 68
Joined: Thu Aug 08, 2013 5:13 pm

Re: unclear 960 position regarding castling

Post by ericlangedijk »

Use the outer most rooks. Ok! Thanks!

@Tibono: Not quite! With the given fen both rooks can be candidates for being the "castling" rook.
In the example it is possible (if we don't know the "outer rook" rule and assume the king was inbetween the rooks) that:
1) the king did not move.
2) the e1 rook is the castling rook and the a1 rook was originally on h1.
3) the a1 rook is the castling rook and the e1 rook was originally on h1
abulmo2
Posts: 493
Joined: Fri Dec 16, 2016 11:04 am
Location: France
Full name: Richard Delorme

Re: unclear 960 position regarding castling

Post by abulmo2 »

ericlangedijk wrote: Tue May 12, 2026 4:09 pm Use the outer most rooks. Ok! Thanks!

@Tibono: Not quite! With the given fen both rooks can be candidates for being the "castling" rook.
In the example it is possible (if we don't know the "outer rook" rule and assume the king was inbetween the rooks) that:
1) the king did not move.
2) the e1 rook is the castling rook and the a1 rook was originally on h1.
3) the a1 rook is the castling rook and the e1 rook was originally on h1
I agree with you. The X-FEN notation is broken and cannot represent any chess 960 positions after having played some moves. Obviously, you cannot describe the case you describe in 2) with it. Fortunately, the S-FEN notation is the de facto standard used by UCI chess 960 engines & GUIs.
Richard Delorme