From 1bbb8a71d9cbebed8672ec7b801b7d479317f8a7 Mon Sep 17 00:00:00 2001 From: Arthur Bols Date: Sun, 18 Dec 2022 16:26:20 +0100 Subject: [PATCH] [Piece] Implement stream operator --- Piece.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Piece.cpp b/Piece.cpp index 4c501e9..5146b4a 100644 --- a/Piece.cpp +++ b/Piece.cpp @@ -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(piece.type()); + if (piece.color() == PieceColor::Black) { + typeNum = std::tolower(typeNum); + } + + os << static_cast(typeNum); return os; }