[Board] Refactor and implement makeMove

This commit is contained in:
2022-12-21 17:20:54 +01:00
parent 0084bbf994
commit 274c29eabd
5 changed files with 212 additions and 62 deletions

View File

@@ -19,18 +19,10 @@ 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;
@@ -42,9 +34,6 @@ 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();