1234567891011121314151617 |
- #include "CheckerPosition.h"
- #include "CheckerConsts.h"
- CheckerPosition::CheckerPosition(int x, int y) : x(x), y(y) {}
- CheckerPosition::CheckerPosition(std::string pos) {
- x = pos[0] - 'A';
- y = pos[1] - '1';
- }
- std::string CheckerPosition::to_string() const {
- return std::string(1, 'A' + x) + std::to_string(y + 1);
- }
- bool CheckerPosition::isValid() const {
- return x >= 0 && x < BOARD_SIZE && y >= 0 && y < BOARD_SIZE;
- }
|