Started to work on king threats
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
final class King: Piece {
|
||||
|
||||
typealias Threats = (Piece?, Piece?)
|
||||
var threats: Threats = (nil, nil)
|
||||
override var unicodeRepresentation: String {
|
||||
return color == .Black ? "♛" : "♕"
|
||||
}
|
||||
@@ -17,12 +18,12 @@ final class King: Piece {
|
||||
].filter { $0.index != nil }
|
||||
}
|
||||
|
||||
override var legalPositions: [Square.Position] {
|
||||
return pseudoLegalPositions.filter { isLegal(on: $0) }
|
||||
}
|
||||
|
||||
override func isLegal(on pos: Square.Position) -> Bool {
|
||||
super.isLegal(on: pos)
|
||||
guard super.isLegal(on: pos) else {
|
||||
return false
|
||||
}
|
||||
// Do stuff
|
||||
return true
|
||||
}
|
||||
|
||||
init(with color: Color, on position: Square.Position) {
|
||||
|
||||
Reference in New Issue
Block a user