[Piece] Add int value functions for color and type

This commit is contained in:
2022-12-21 00:24:48 +01:00
parent 96a6188f0c
commit 414009fe6b
2 changed files with 11 additions and 0 deletions

View File

@@ -19,9 +19,18 @@ PieceColor Piece::color() const {
return mColor;
}
int Piece::colorVal() const {
return static_cast<int>(mColor);
}
PieceType Piece::type() const {
return mType;
}
int Piece::typeVal() const {
return static_cast<int>(mType);
}
std::optional<PieceType> Piece::pieceTypeFromSymbol(char symbol) {
switch (toupper(symbol)) {
case 'P': return PieceType::Pawn;

View File

@@ -32,6 +32,8 @@ public:
PieceColor color() const;
PieceType type() const;
int colorVal() const;
int typeVal() const;
private:
const PieceColor mColor;