lichess-org / lila

♞ lichess.org: the forever free, adless and open source chess server ♞
https://lichess.org
GNU Affero General Public License v3.0
15.72k stars 2.28k forks source link

Castling not possible in Chess960 in certain cases #2514

Closed ThomasR closed 7 years ago

ThomasR commented 7 years ago

In this game, I was not able to castle king-side, even though it was legally allowed.

1q3rk1/ppnp1b1p/1n4p1/2NP1p2/2P1p3/2Q1P2P/PP2BPP1/1R2K2R w KQ - 3 15

Note how the analysis board also does not allow O-O at any time. However, O-O-O works perfectly fine, as can be seen by the markers around the rook.

Black played 14. … O-O in the actual game, but the analysis board won't let me do this move.

1q2k2r/ppnp1b1p/1n4p1/2NP1p2/2P1p3/2Q1P2P/PP2BPP1/1R2K2R b KQk - 2 14

When using the FEN analysis, the issue also occurs, but only when the Castle by moving by two squares preference is set, which should have no effect on Chess960.

ThomasR commented 7 years ago

Not sure how this fixes the issue. I haven't really understood the code, but something feels fishy.

Again, the issue was

  1. White cannot O-O
  2. White can O-O-O (rook on the b file!)
  3. Black cannot O-O in the analysis board
  4. Black did O-O in the actual game
ornicar commented 7 years ago

I updated our stage environment: https://stage.lichess.org

Would you like to try and reproduce the bug there? Thanks.

ThomasR commented 7 years ago

Looks like the bug does not occur any more.

I'm still puzzled by how black was able to castle in the game. My first guess would have been pre-move since the logic there is different (and correct), but the move time was 60 seconds, so it must have been a normal move.

Any ideas?

niklasf commented 7 years ago

Couple options:

ddugovic commented 7 years ago

Maybe Black typed O-O into the move field below the board?

ornicar commented 7 years ago

The bug only happens with a non-default user preference about castling. Last one on https://en.lichess.org/account/preferences/game-behavior