// // Created by hamac on 18.12.2024. // #include #include #include class Chesspiece { private: /* fields */ // ToDo: von char auf enum Color {W, B} umstellen char color; char identifier; std::pair position; std::vector positions; /* methods */ virtual std::vector calcAvaibleMoves() = 0; public: virtual ~Chesspiece() = default; std::pair getPosition() { return this->position; }; void setPosition(std::pair position) { this->position = position; calcAvaibleMoves(); } char getColor() { return this->color; } void setColor(char color) { this->color = color; } std::vector getPositions() { return this->positions; } Ad bool checkNotation(std::string notation) { std::regex pattern(R"^([KQRNBP]?)([a-h][1-8])[-x]([a-h][1-8])([+#]?)$"); std::smatch match; return (std::regex_search(notation, match, pattern) ? true : false); } };