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

Crazyhouse en passant bug with DropMove #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dbergan
Copy link

@dbergan dbergan commented Apr 17, 2023

Fixes #23

Copy link
Collaborator

@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.

Thanks for taking the time to debug this. For now I just commented about the code, not the bug itself.
I need to take the time to replay the bug myself to understand why it occurs in crazyhouse.

a = a.playSan('Bd8');

a = a.playSan('Nc3');
printBoard(a, printLegalMoves: true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

No print should be left


a = a.playSan(
'Q@f7'); // Bug: copyWith() is given null for epSquare, which then copies White's epSquare of f6 forward to Black
final List<Move> legalMoves = printBoard(a, printLegalMoves: true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's a bit weird to define legalMoves using a printBoard function; I think you can just use a list literal instead.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm concerned with this whole file. While I understand how it can help you to understand better a situation and see the legal moves for a position I think it should stay private code.
If that code was meant to be in the repo I'd name things differently (MyExpectations is a bit vague) and put doc comments.

You're comparing the number of legal moves in a position. In a way it's like perft, so I think this whole test should be replaced by a perft test.
Perft has the advantage of being a standard and I prefer dartchess to use such standards. Another great advantage is that you can run perft tests on other chess libraries to ensure even more the validity.

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.

Crazyhouse en passant bug with DropMove
2 participants