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

Add en passant option in Editor #950

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

HaonRekcef
Copy link
Contributor

Adds the option to enpassant in the editor, similar as its done on the website, as well as corresponding tests:

screen-20240830-233327.mp4

remarks:

  • if no en passant could be possible the option is not shown
  • it is checked if there is an adjacent opposing pawn and if the two squares where he would have moved through are empty

Copy link
Contributor

@veloce veloce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

lib/src/view/board_editor/board_editor_menu.dart Outdated Show resolved Hide resolved
lib/src/model/board_editor/board_editor_controller.dart Outdated Show resolved Hide resolved
@@ -59,14 +61,66 @@ class BoardEditorController extends _$BoardEditorController {
state = state.copyWith(
sideToPlay: side,
);
_calculateEnPassantOptions();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to have atomic state changes, so:

state = state.copyWith(
  sideToPlay: side,
  enPassantOptions: _calculateEnPassantOptions(),
);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done here: 9dc7df0

@veloce veloce merged commit c86fb0c into lichess-org:main Sep 9, 2024
1 check passed
@HaonRekcef HaonRekcef deleted the editor-enpassant branch September 9, 2024 08:09
@olivertzeng
Copy link

Holy hell!
New update just dropped

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

Successfully merging this pull request may close these issues.

3 participants