From e9d328acf4ee45bd8771d422fa4db40298e6e16a Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sat, 29 Jan 2022 11:52:47 +0100 Subject: Init project --- src/Piece.hpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/Piece.hpp (limited to 'src/Piece.hpp') diff --git a/src/Piece.hpp b/src/Piece.hpp new file mode 100644 index 0000000..73791a0 --- /dev/null +++ b/src/Piece.hpp @@ -0,0 +1,27 @@ +#include +#include + +#define PIECE__IS_VALID(f, r) ((f) >= 'a' && (f) <= 'h' && (r) >= '1' && (r) <= '8') +#define PIECE__ADD_MOVE(f, r) \ + { \ + if (PIECE__IS_VALID(f, r)) { \ + moves.push_back(std::string() + (char)((f)) + (char)((r))); \ + } \ + } + +namespace chessarbiter { + +/** + * Member are public for conveniance + */ +class Piece { +public: + bool isBlack; + std::string coord; + char piece; + Piece(char c, std::string coord); + /// @brief Get all possible moves according to the type of piece and its position + std::vector GetMoves(); +}; + +} // namespace chessarbiter \ No newline at end of file -- cgit v1.2.3