#ifndef CHESS_ENGINE_PIECE_HPP #define CHESS_ENGINE_PIECE_HPP #include #include enum class PieceColor { White = 0, Black = 1, }; enum class PieceType { Pawn = 0b000, Knight = 0b010, Bishop = 0b100, Rook = 0b110, Queen = 0b1000, King = 0b1010 }; class Piece { public: using Optional = std::optional; Piece(PieceColor color, PieceType type); static Optional fromSymbol(char symbol); static std::optional pieceTypeFromSymbol(char symbol); PieceColor color() const; PieceType type() const; int colorVal() const; int typeVal() const; private: const PieceColor mColor; const PieceType mType; }; bool operator==(const Piece &lhs, const Piece &rhs); std::ostream &operator<<(std::ostream &os, const Piece &piece); // Invert a color (White becomes Black and vice versa) PieceColor operator!(PieceColor color); #endif