diff options
Diffstat (limited to 'Sources/SwiftChessNeo/Piece.swift')
-rw-r--r-- | Sources/SwiftChessNeo/Piece.swift | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Sources/SwiftChessNeo/Piece.swift b/Sources/SwiftChessNeo/Piece.swift index 492ad87..d97efe1 100644 --- a/Sources/SwiftChessNeo/Piece.swift +++ b/Sources/SwiftChessNeo/Piece.swift @@ -287,6 +287,17 @@ public struct Piece: Hashable, CustomStringConvertible { case .king: return "♚" } } + + public func getNaturalName() -> String { + switch kind { + case .pawn: return self.color.isWhite ? "White Pawn" : "Black Pawn" + case .bishop: return self.color.isWhite ? "White Bishop" : "Black Bishop" + case .king: return self.color.isWhite ? "White King" : "Black King" + case .queen: return self.color.isWhite ? "White Queen" : "Black Queen" + case .rook: return self.color.isWhite ? "White Rook" : "Black Rook" + case .knight: return self.color.isWhite ? "White Knight" : "Black Knight" + } + } } |