Board(Grid) -> FEN
This commit is contained in:
@@ -12,6 +12,20 @@ public enum Kind: String, CaseIterable {
|
||||
}
|
||||
}
|
||||
|
||||
func fenRepresentation(with color: Color) -> String {
|
||||
let str =
|
||||
switch self {
|
||||
case .Pawn: "P"
|
||||
case .Bishop: "B"
|
||||
case .Knight: "N"
|
||||
case .Rook: "R"
|
||||
case .Queen: "Q"
|
||||
case .King: "K"
|
||||
}
|
||||
|
||||
return color == .White ? str : str.lowercased()
|
||||
}
|
||||
|
||||
static subscript(_ c: Character) -> (Self, Color)? {
|
||||
let v = c.uppercased()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user