lichess.org
Donate

Bug: Board editor creates invalid FEN, analysis board accepts it

In the board editor, you have selected that White is allowed to castle queenside. Therefore, White can castle with the rook on a1. To make it work as you expect, you need to uncheck the castling rights for White (or remove the "Q" from the FEN).
@laneo

Thanks for your reply.

I didn't choose any castling option. The Lichess FEN generator correctly removes White's kingside option itself, but not the queenside option. If you try to include kingside castling, you can't. Besides this being inconsistent, the generator should never generate an invalid FEN, even if the user makes a mistake. Invalid FENs shouldn't be accepted as input, either.

I've tried this on the chess website that shall not be named and it works the way it should. I could not make it generate an invalid FEN for the position in question, and it won't accept the one Lichess creates.
If you paste this FEN in the lichess app it crashes:
rnbqkbnr/pppppppp/8/8/8/7R/PPPPPPPP/RNBQKBNR w KQkq - 0 1
Since there is no separate variant for Fischer random in the editor, it detects both standard and Fischer random to be the same. Therefore, if the king and the rook haven't moved after you click the Analysis board, castling can still be done if you didn't uncheck the required box. Because in Fischer random, if the king and the rook didn't move, the king could castle even if it wasn't on e1 at the start of the game.

Technically, even though Fischer random is a separate variant, I don't think there should be a separate variant in the board editor because the pieces move the same way, and the rules are the same.
@subalias said in #3:
> I didn't choose any castling option. The Lichess FEN generator correctly removes White's kingside option itself, but not the queenside option. If you try to include kingside castling, you can't. Besides this being inconsistent, the generator should never generate an invalid FEN, even if the user makes a mistake. Invalid FENs shouldn't be accepted as input, either.

In this position, there is no white rook on the right side of the white king, so kingside castling is certainly impossible even in chess960, so it is automatically disabled. But if queenside castling would get automatically disabled, then it would be impossible to input some chess960 positions, so it's up to the user to set up castling rights correctly.

Of course, if you input a position that is only legal in chess960, then this position cannot be handled by programs that do not deal with chess960. I would call this a feature and not a bug.

However, the way Lichess implements this isn't enough to handle *all* chess960 scenarios, because if both rooks are on the same side of the king (i.e. one rook has moved), then the castling right always refers to the rook that's farther away from the king, and I think there's no way to give the castling right to the other rook. I think something like X-FEN would be necessary for that.
@White1970

There is no point in allowing the user to select a variant in the board editor if the FEN doesn't represent it. How many users will have any idea that this can happen? I only found out the FEN was invalid when I tried to use it in other software. What a waste of time and energy this has been.

Edit: I forgot my manners. Thanks for your help.
@laneo

I don't understand why Lichess puts a burden on users to simply know that choosing Standard in the board editor means choosing 960 as well. Even if a warning was given that FENs might represent 960, it would still cause confusion for many users. Standard should mean Standard only. The way it is has caused me to waste time and energy, and you and others as well in clearing things up for me.

Anyway, thanks again for your input.
@subalias
Yes that's true. From a programmer's point of view, it's easier and more elegant to solve two things with a single implementation, but from a user's point of view it's confusing or unexpected that "Standard" works like "Chess960" in the board editor.

This topic has been archived and can no longer be replied to.