[Piece] Implement stream operator

This commit is contained in:
2022-12-18 16:26:20 +01:00
parent 2970fe1406
commit 1bbb8a71d9

View File

@@ -50,7 +50,12 @@ bool operator==(const Piece &lhs, const Piece &rhs) {
}
std::ostream &operator<<(std::ostream &os, const Piece &piece) {
(void) piece;
int typeNum = static_cast<int>(piece.type());
if (piece.color() == PieceColor::Black) {
typeNum = std::tolower(typeNum);
}
os << static_cast<char>(typeNum);
return os;
}