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

Make en passant more flexible #31

Open
alexobviously opened this issue Feb 1, 2023 · 1 comment
Open

Make en passant more flexible #31

alexobviously opened this issue Feb 1, 2023 · 1 comment
Labels
enhancement New feature or request rule New rule request

Comments

@alexobviously
Copy link
Owner

alexobviously commented Feb 1, 2023

Original comment: Should probably roll enPassant and firstMoveRanks into one EnPassantOptions class, to match the new paradigm and clean up all the chess-specific stuff in Variant.

But I've also realised that there are some more complex versions of en passant that we probably want to support. For example, when pawns can move 3+ spaces on the first move, it should be possible to capture them en passant on any of the intermediate squares (see: wildebeest chess, chess on a really big board).

I think the solution is to make en passant an implementation of the upcoming custom move generator, and have the en passant options param at the variant level just compile to a custom generator.

Another issue is with storing en passant squares in the state and zobrist hash. I think we can safely make it a list of ints in the state, and maybe just store one in the hash.

@alexobviously alexobviously added enhancement New feature or request good first issue Good for newcomers labels Feb 1, 2023
@alexobviously alexobviously removed the good first issue Good for newcomers label Mar 17, 2023
@alexobviously alexobviously changed the title Change En Passant param in variant to match others, e.g. PromotionOptions, CastlingOptions Make en passant more flexible Mar 17, 2023
@alexobviously alexobviously added the rule New rule request label Mar 17, 2023
@alexobviously
Copy link
Owner Author

A limitation: statelessly calculating the piece to be captured en-passant doesn't currently work.
e.g. if you start a berolina chess game from a FEN position where there's an EP square defined, it will be possible to move to it but the moving piece won't be captured.
Playing through the whole game and making the same enpassant move will work, it's just if you start from a position with EP possible.

Another related but different problem: even if this is fixed, variants like berolina where multiple pawns can end up on the same square on the first move (e.g. a2c4 and e2c4) won't be able to disambiguate without extra info in the FEN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request rule New rule request
Projects
None yet
Development

No branches or pull requests

1 participant