[Piece] Implement stream operator
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user