[Piece] Add fromValue

This commit is contained in:
2022-12-21 10:41:46 +01:00
parent c510b30f55
commit 123e473a53
4 changed files with 13 additions and 9 deletions

View File

@@ -42,6 +42,9 @@ std::optional<PieceType> Piece::pieceTypeFromSymbol(char symbol) {
default: return std::nullopt;
}
}
Piece::Optional Piece::fromValue(unsigned int value) {
return Piece(valToColor(value), valToType(value));
}
bool operator==(const Piece &lhs, const Piece &rhs) {
return lhs.color() == rhs.color() && lhs.type() == rhs.type();