24 lines
553 B
Swift
24 lines
553 B
Swift
final class Bishop: Piece, DiagonalMoves {
|
|
|
|
override var unicodeRepresentation: String {
|
|
return color == .Black ? "♝" : "♗"
|
|
}
|
|
|
|
override var pseudoLegalPositions: [Square.Position] {
|
|
return getDiagonalMoves(from: position)
|
|
}
|
|
|
|
override var legalPositions: [Square.Position] {
|
|
return pseudoLegalPositions.filter { isLegal(on: $0) }
|
|
}
|
|
|
|
override func isLegal(on pos: Square.Position) -> Bool {
|
|
super.isLegal(on: pos)
|
|
}
|
|
|
|
init(with color: Color, on position: Square.Position) {
|
|
super.init(kind: .Bishop, on: position, with: color)
|
|
}
|
|
|
|
}
|