Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have a parseCastlingFen equivalent for enPassant #154

Closed
TheMadSword opened this issue Dec 5, 2023 · 1 comment
Closed

Have a parseCastlingFen equivalent for enPassant #154

TheMadSword opened this issue Dec 5, 2023 · 1 comment

Comments

@TheMadSword
Copy link

TheMadSword commented Dec 5, 2023

Currently in chessops, you have to setup a whole Position to know if a legalEpSquare exist. I think it may be logical to have a parseCastlingFen equivalent for enPassant; something like parseEnPassantFen(board, turnPart, epPart), returning a square if valid or undefined if the epPart isn't valid (e.g. 'd3' but no pawn or missing other pawn on the board).

I'm creating this issue as I'm doing lichess-org/lila#14139, and you need to wait for the "legalFen" [editor/src/ctrl.ts] to be created, which uses getSetup, which call parseFen & parseCastlingFen; so it is weird to not be able to valid enPassant there (while it is done with castling).

I also notice that in parseFen@fen.ts, only the fact that the square exist is validated, but not it's en-passant properties.

What do you think of it ?

edit : also possibly a way of getting all epSquares possibility.

@niklasf
Copy link
Owner

niklasf commented Dec 10, 2023

parseCastlingFen works on Setup-level (or specifically Board), i.e., matching rooks because it's necessary to understand the notation, but not yet taking rules into account. An equivalent parseEpSquare is basically just parseSquare.

Since this is about the board editor specifically ... the castling toggles are always there. Toggles can be used and rooks can be placed in any order. It would be consistent to allow selecting any en passant file at all times.

@niklasf niklasf closed this as completed Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants