Skip to content

fix rook positions after clearing board #1942

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

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

borg323
Copy link
Member

@borg323 borg323 commented Jan 13, 2024

No description provided.

@@ -51,6 +51,7 @@ const BitBoard ChessBoard::kPawnMask = 0x00FFFFFFFFFFFF00ULL;

void ChessBoard::Clear() {
std::memset(reinterpret_cast<void*>(this), 0, sizeof(ChessBoard));
castlings_.SetRookPositions(FILE_A, FILE_H, FILE_A, FILE_H);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this would be more error-safe:
add ChessBoard& operator=(const ChessBoard&) = default;, and then

void ChessBoard::Clear() {
  *this = ChessBoard();
}

?

Copy link
Member Author

Choose a reason for hiding this comment

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

I like it.

@borg323 borg323 merged commit f8d02bb into LeelaChessZero:master Feb 21, 2024
PikaCat-OuO pushed a commit to official-pikafish/px0 that referenced this pull request Feb 23, 2024
@mooskagh mooskagh mentioned this pull request Feb 23, 2024
@borg323 borg323 deleted the board_fix branch February 24, 2024 16:17
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.

2 participants