Game.h 998 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef GAME_H
  2. #define GAME_H
  3. #include <array>
  4. #include "String.h"
  5. #include "Types.h"
  6. class Game final {
  7. public:
  8. enum FieldState {
  9. BLACK, WHITE, EMPTY
  10. };
  11. Game();
  12. void parse();
  13. private:
  14. void consumeLine() const;
  15. void consumeLine(uint index);
  16. void parseFields();
  17. void selectStone();
  18. void selectLocationToMove();
  19. void selectStoneToTake();
  20. void move(int fromX, int fromY, int toX, int toY);
  21. bool isInRange(int x, int y) const;
  22. void print(String& s) const;
  23. void printLine(String& s, int index) const;
  24. int getRank(int x, int y, int x2, int y2) const;
  25. bool areNeighbours(int x, int y, int x2, int y2) const;
  26. void addLocation(int x, int y);
  27. bool isInQueue(int x, int y) const;
  28. FieldState fields[9][5];
  29. int activeX;
  30. int activeY;
  31. int directionX;
  32. int directionY;
  33. struct Location {
  34. int x;
  35. int y;
  36. };
  37. std::array<Location, 20> lastLocations;
  38. uint lastLocation;
  39. };
  40. #endif