-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement threefold repetition check (#37)
* LegalCastlings and PieceSet are now Hashable * Implemented "occurred" function to check position repetition * Implemented position hashed value * Added gamePositions dicitonary to "Board" and check for Threefold repetition * Added test to check Threefold repetition * Re-added Sendable to LegalCastlings * Position now conforms to Hashable protocol * Moved part of Threefold repetition check logic from Position to Board * Added sideSquares property to Piece * Fixed a bug where enPassant pawn would be written inside the FEN notation every time a pawn moved by 2 squares * Changed Threefold repetition test according to the new structure * Fixed boardPermormanceTest according to the FEN notation change * Implemented check to avoid writing enPassant square into FEN notation when it would lead to a check * Changed test according to new check * Added check to avoid writing enPassant square in FEN notation when the nearby pawn is not of the opposite color * Removed sideSquares from "Piece.swift" * Renamed `canBeCaptured` function to `couldBeCaptured` * Re-inserted all the enPassant capture square inside the different FEN notations * Added "enPassantIsPossible" var to Position * Added left and right Square variables * Added function "validateEnPassant" and removed all the old part * Added test for double enPassant One pawn can execute it, one cannot * Now `couldBeCaptured(...)` function is again Internal * Square `left` and `right` matches the project style * Removed `board.hashedPositions()` and changed test accordingly * Indentation changes
- Loading branch information
Showing
8 changed files
with
129 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters