diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-01-29 11:52:47 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-01-29 11:52:47 +0100 |
| commit | e9d328acf4ee45bd8771d422fa4db40298e6e16a (patch) | |
| tree | 68a86c53539fe57b434c49555feafac9081f75e0 /src/Piece.hpp | |
Init project
Diffstat (limited to 'src/Piece.hpp')
| -rw-r--r-- | src/Piece.hpp | 27 |
1 files changed, 27 insertions, 0 deletions
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 <string> +#include <vector> + +#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<std::string> GetMoves(); +}; + +} // namespace chessarbiter
\ No newline at end of file |
