Fix a bug that allowed castling even if squares were attacked #3

Merged
marco merged 1 commits from castling-through-check into master 2024-04-09 19:55:40 +00:00
Owner
No description provided.
marco added 1 commit 2024-04-09 19:50:28 +00:00
marco reviewed 2024-04-09 19:51:45 +00:00
@ -69,3 +67,3 @@
)
func (k King) movedOnValidCastlingSquare(b *Board, move types.Move) (bool, CastlingDirection) {
func (k King) isCastlingAllowed(b *Board, move types.Move) (bool, CastlingDirection) {
Author
Owner

This function is just ugly.
It checks a lot of things. The code for the black and white branches are almost the same. This should be done in multiple steps in a more systematic fashion.

This function is just ugly. It checks a lot of things. The code for the black and white branches are almost the same. This should be done in multiple steps in a more systematic fashion.
marco merged commit 4153f4cc7c into master 2024-04-09 19:55:40 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: marco/mchess-server#3
No description provided.