[Board] Refactor and implement makeMove
This commit is contained in:
11
Piece.cpp
11
Piece.cpp
@@ -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();
|
||||
|
Reference in New Issue
Block a user