miguel-ambrona / sherlock

A chess library written in Rust, oriented to creating and solving chess compositions with especial emphasis on retrograde analysis.
MIT License
5 stars 0 forks source link

white king and queen illegally switched on the first rank #42

Closed hwatheod closed 2 weeks ago

hwatheod commented 1 month ago

Sherlock doesn't detect this position as illegal: 2b4r/p2p1pp1/2p1r2p/1p2q1k1/P1Nnp3/8/1PPPPPPP/R1B1KQ1R w - -

Issue

The white king and queen are illegally switched on the first rank.

miguel-ambrona commented 4 weeks ago

Nice! With any white castling enabled this would already be identified as illegal.

Any ideas on how to fix this?

hwatheod commented 3 weeks ago

This one (and the similar number 43) is hardcoded as a rule into Retractor. If the king and queen never left the first rank, then their order cannot be switched. There are many similar ordering rules, described here. (A note on terminology: Retractor 'frozen' = Sherlock 'steady')