You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.7 KiB

2 months ago
  1. #pragma once
  2. #include <iostream>
  3. #include <utility>
  4. #include <vector>
  5. typedef std::pair<int, int> coordinates;
  6. class Grid;
  7. enum class Type : char {
  8. Wall = 'W',
  9. Floor = ' ',
  10. Door = 'D',
  11. LockedDoor = 'L',
  12. Key = 'K',
  13. Ball = 'A',
  14. Box = 'B',
  15. Goal = 'G',
  16. Lava = 'V',
  17. Agent = 'X',
  18. Adversary = 'Z',
  19. SlipperyNorth = 'n',
  20. SlipperySouth = 's',
  21. SlipperyEast = 'e',
  22. SlipperyWest = 'w',
  23. SlipperyNorthWest = 'a',
  24. SlipperyNorthEast = 'b',
  25. SlipperySouthWest = 'c',
  26. SlipperySouthEast = 'd'
  27. };
  28. enum class Color : char {
  29. Red = 'R',
  30. Green = 'G',
  31. Blue = 'B',
  32. Purple = 'P',
  33. Yellow = 'Y',
  34. White = 'W',
  35. //Grey = 'G',
  36. None = ' '
  37. };
  38. constexpr std::initializer_list<Color> allColors = {Color::Red, Color::Green, Color::Blue, Color::Purple, Color::Yellow};
  39. std::string getColor(Color color);
  40. class cell {
  41. public:
  42. coordinates getNorth() const { return std::make_pair(column, row - 1); }
  43. coordinates getSouth() const { return std::make_pair(column, row + 1); }
  44. coordinates getEast() const { return std::make_pair(column + 1, row); }
  45. coordinates getWest() const { return std::make_pair(column - 1, row); }
  46. cell getNorth(const std::vector<cell> &grid) const;
  47. cell getEast(const std::vector<cell> &grid) const;
  48. cell getSouth(const std::vector<cell> &grid) const;
  49. cell getWest(const std::vector<cell> &grid) const;
  50. friend std::ostream& operator<<(std::ostream& os, const cell& cell);
  51. coordinates getCoordinates() const;
  52. std::string getColor() const;
  53. std::string getType() const;
  54. int row;
  55. int column;
  56. Type type;
  57. Color color;
  58. };