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.

62 lines
1.5 KiB

1 year 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. };
  24. enum class Color : char {
  25. Red = 'R',
  26. Green = 'G',
  27. Blue = 'B',
  28. Purple = 'P',
  29. Yellow = 'Y',
  30. //Grey = 'G',
  31. None = ' '
  32. };
  33. constexpr std::initializer_list<Color> allColors = {Color::Red, Color::Green, Color::Blue, Color::Purple, Color::Yellow};
  34. std::string getColor(Color color);
  35. class cell {
  36. public:
  37. coordinates getNorth() const { return std::make_pair(row - 1, column); }
  38. coordinates getSouth() const { return std::make_pair(row + 1, column); }
  39. coordinates getEast() const { return std::make_pair(row, column + 1); }
  40. coordinates getWest() const { return std::make_pair(row, column - 1); }
  41. cell getNorth(const std::vector<cell> &grid) const;
  42. cell getEast(const std::vector<cell> &grid) const;
  43. cell getSouth(const std::vector<cell> &grid) const;
  44. cell getWest(const std::vector<cell> &grid) const;
  45. friend std::ostream& operator<<(std::ostream& os, const cell& cell);
  46. coordinates getCoordinates() const;
  47. std::string getColor() const;
  48. int row;
  49. int column;
  50. Type type;
  51. Color color;
  52. };