chessarbiter/src/Piece.hpp
2023-05-10 06:55:12 +02:00

27 lines
No EOL
872 B
C++

#include <string>
#include <vector>
#define IS_FR_VALID(f, r) ((f) >= 'a' && (f) <= 'h' && (r) >= '1' && (r) <= '8')
#define ADD_MOVE(f, r) \
{ \
if (IS_FR_VALID(f, r)) { \
moves.push_back(std::string() + (char)((f)) + (char)((r))); \
} \
}
namespace chessarbiter {
/**
* Member are public for conveniance
*/
class Piece {
public:
char piece;
bool isBlack;
std::string coord;
Piece(char c, const std::string &coord);
/// @brief Get all possible moves according to the type of piece and its position
std::vector<std::string> GetMoves();
};
} // namespace chessarbiter