Lots of changes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
enum Kind: String, CaseIterable {
|
||||
public enum Kind: String, CaseIterable {
|
||||
case Pawn, Knight, Bishop, Rook, Queen, King
|
||||
|
||||
var value: Int8 {
|
||||
@@ -39,14 +39,28 @@ enum Kind: String, CaseIterable {
|
||||
}
|
||||
}
|
||||
|
||||
protocol Piece {
|
||||
var board: Board? { get }
|
||||
var color: Color { get }
|
||||
var unicodeRepresentation: String { get }
|
||||
var kind: Kind { get }
|
||||
var position: Square.Position { get }
|
||||
var pseudoLegalPositions: [Square.Position] { get }
|
||||
var legalPositions: [Square.Position] { get }
|
||||
func move(to dst: Square.Position) -> Bool
|
||||
func isLegal(on pos: Square.Position) -> Bool
|
||||
public class Piece {
|
||||
#warning("TODO: TO be removed, handle everything through the delegate")
|
||||
internal weak var board: Board?
|
||||
public internal(set) var color: Color
|
||||
public var unicodeRepresentation: String {
|
||||
return ""
|
||||
}
|
||||
public internal(set) var kind: Kind
|
||||
public internal(set) var position: Square.Position
|
||||
internal var pseudoLegalPositions: [Square.Position] {
|
||||
return []
|
||||
}
|
||||
internal var legalPositions: [Square.Position] {
|
||||
return []
|
||||
}
|
||||
internal var delegate: EventDelegate?
|
||||
internal func move(to dst: Square.Position) {}
|
||||
internal func isLegal(on pos: Square.Position) -> Bool { false }
|
||||
|
||||
internal init(kind: Kind, on pos: Square.Position, with col: Color) {
|
||||
self.kind = kind
|
||||
self.position = pos
|
||||
self.color = col
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user