aboutsummaryrefslogtreecommitdiff
path: root/Sources/SwiftChessNeo
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2024-04-17 17:07:24 -0600
committerNavan Chauhan <navanchauhan@gmail.com>2024-04-17 17:07:24 -0600
commit081adb89d7f5c8e80961e3873654be3473faef71 (patch)
treed64151ad8d3b06077dae64952d0bacdcd2e9a103 /Sources/SwiftChessNeo
parent8e5bf91607d5d222f22676411eda7c0ac9a90427 (diff)
add option to get image name
Diffstat (limited to 'Sources/SwiftChessNeo')
-rw-r--r--Sources/SwiftChessNeo/Piece.swift11
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"
+ }
+ }
}