123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #ifndef GAME_H
- #define GAME_H
- #include <array>
- #include "String.h"
- #include "Types.h"
- class Game final {
- public:
- enum FieldState {
- BLACK, WHITE, EMPTY
- };
- Game();
- void parse();
- private:
- void consumeLine() const;
- void consumeLine(uint index);
- void parseFields();
- void selectStone();
- void selectLocationToMove();
- void selectStoneToTake();
- void move(int fromX, int fromY, int toX, int toY);
- bool isInRange(int x, int y) const;
- void print(String& s) const;
- void printLine(String& s, int index) const;
- int getRank(int x, int y, int x2, int y2) const;
- bool areNeighbours(int x, int y, int x2, int y2) const;
- void addLocation(int x, int y);
- bool isInQueue(int x, int y) const;
- FieldState fields[9][5];
- int activeX;
- int activeY;
- int directionX;
- int directionY;
- struct Location {
- int x;
- int y;
- };
- std::array<Location, 20> lastLocations;
- uint lastLocation;
- };
- #endif
|