Skip to content

Conversation

@MichaelMrt
Copy link
Owner

Move class

This pull request involves refactoring the chess game logic to use a Move object as parameters instead of separate coordinate parameters. The 4 parameters required for most methods are now encapsulated in a single object making the code easier to read and saving space
Closes #78

can_move_to_square method

The the method for white and black have been merged into one by giving a parameter for the color you want to check if it can move to a square / field.
Closes #113

Optimized checkmate handling

The handle_checkmate() Method has been almost halfed by adding a color parameter and reusing the whole code. Furthermore the loop just breaks as soon as a legal escape move is found. The loop also only triggers when you are in check

@MichaelMrt MichaelMrt added the Refactoring Better structure, Increasing readability label Feb 6, 2025
@MichaelMrt MichaelMrt merged commit 2ae4ba1 into main Feb 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactoring Better structure, Increasing readability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

...can_move_to_square() has to be reworked remove as many arguments from functions as possible

2 participants