Some refactor and tests

This commit is contained in:
cdricms
2024-06-27 19:13:13 +02:00
parent 8b5c2a592e
commit 8556380dba
5 changed files with 88 additions and 40 deletions

View File

@@ -10,7 +10,16 @@ final class King: Piece {
var position: Square.Position
var pseudoLegalPositions: [Square.Position] {
return []
[
position + (1, 0),
position + (1, 1),
position + (0, 1),
position + (-1, 1),
position + (-1, 0),
position + (-1, -1),
position + (0, -1),
position + (1, -1)
].filter {$0.index != nil}
}
var legalPositions: [Square.Position] {