Can now move pieces

This commit is contained in:
cdricms
2024-06-28 19:35:43 +02:00
parent 501484558a
commit 4f5b51f4ae
11 changed files with 125 additions and 109 deletions

View File

@@ -12,20 +12,8 @@ final class Bishop: Piece, DiagonalMoves {
return pseudoLegalPositions.filter { isLegal(on: $0) }
}
override func move(to dst: Square.Position) {
}
override func isLegal(on pos: Square.Position) -> Bool {
if let board = board, let s = board[pos] {
if let p = s.piece {
if p.color == color { return false }
if p.kind == .King {
delegate?.notify(.kingInCheck(self))
return false
}
}
}
return true
super.isLegal(on: pos)
}
init(with color: Color, on position: Square.Position) {