Game.h 943 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. bool isInRange(int x, int y) const;
  21. void print(String& s) const;
  22. void printLine(String& s, int index) const;
  23. int getRank(int x, int y, int x2, int y2) const;
  24. bool areNeighbours(int x, int y, int x2, int y2) const;
  25. void addLocation(int x, int y);
  26. bool isInQueue(int x, int y) const;
  27. FieldState fields[9][5];
  28. int activeX;
  29. int activeY;
  30. int directionX;
  31. int directionY;
  32. struct Location {
  33. int x;
  34. int y;
  35. };
  36. std::array<Location, 20> lastLocations;
  37. uint lastLocation;
  38. };
  39. #endif