lichess-org / scalachess

Chess API written in scala. Immutable and free of side effects.

Home Page:https://lichess.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Atomic castling with touching kings

thomas-daniels opened this issue · comments

This paper, written by FICS player Rekursiv, outlines all atomic rules as employed on FICS, and Lichess is using the same ruleset.

Quoting the paper:

As in normal chess, it is illegal to castle if your king has previously moved or if your rook with which you are castling has previously moved. It is also illegal to castle if you are currently in atomic check, if moving the king one square closer to the rook (with the rook staying put) would place you in atomic check (i.e. you cannot castle through check), or if completing castling would place you in atomic check.

Now consider this position: https://lichess.org/analysis/atomic/8/8/8/8/8/8/5k2/R3K2r_w_Q_-

Lichess allows O-O-O in here, which is inconsistent with this ruleset ("illegal [...] if moving the king one square closer to the rook (with the rook staying put) would place you in atomic check").

(Note that, when changing this, we must ensure that O-O-O stays valid in https://lichess.org/analysis/atomic/8/8/8/8/8/8/4k3/R3K2r_w_Q_- - Lichess correctly allows O-O-O in here.)

cc @niklasf