[Piece] Add int value functions for color and type
This commit is contained in:
@@ -19,9 +19,18 @@ PieceColor Piece::color() const {
|
|||||||
return mColor;
|
return mColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Piece::colorVal() const {
|
||||||
|
return static_cast<int>(mColor);
|
||||||
|
}
|
||||||
|
|
||||||
PieceType Piece::type() const {
|
PieceType Piece::type() const {
|
||||||
return mType;
|
return mType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Piece::typeVal() const {
|
||||||
|
return static_cast<int>(mType);
|
||||||
|
}
|
||||||
|
|
||||||
std::optional<PieceType> Piece::pieceTypeFromSymbol(char symbol) {
|
std::optional<PieceType> Piece::pieceTypeFromSymbol(char symbol) {
|
||||||
switch (toupper(symbol)) {
|
switch (toupper(symbol)) {
|
||||||
case 'P': return PieceType::Pawn;
|
case 'P': return PieceType::Pawn;
|
||||||
|
Reference in New Issue
Block a user