From 081adb89d7f5c8e80961e3873654be3473faef71 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Wed, 17 Apr 2024 17:07:24 -0600 Subject: add option to get image name --- Sources/SwiftChessNeo/Piece.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Sources/SwiftChessNeo') 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" + } + } } -- cgit v1.2.3