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.

65 lines
1.5 KiB

  1. #pragma once
  2. #include <iostream>
  3. #include <fstream>
  4. #include <map>
  5. #include <utility>
  6. #include "MinigridGrammar.h"
  7. #include "PrismModulesPrinter.h"
  8. struct GridOptions {
  9. std::vector<AgentName> agentsToBeConsidered;
  10. std::vector<AgentName> agentsWithView;
  11. std::vector<AgentName> agentsWithProbabilisticBehaviour;
  12. std::vector<float> probabilitiesForActions;
  13. bool enforceOneWays;
  14. };
  15. class Grid {
  16. public:
  17. Grid(cells gridCells, cells background, const GridOptions &gridOptions, const std::map<coordinates, float> &stateRewards = {});
  18. cells getGridCells();
  19. bool isBlocked(coordinates p);
  20. bool isWall(coordinates p);
  21. bool isLockedDoor(coordinates p);
  22. bool isUnlockedDoor(coordinates p);
  23. bool isKey(coordinates p);
  24. bool isBox(coordinates p);
  25. void printToPrism(std::ostream &os, const prism::ModelType& modelType);
  26. std::array<bool, 8> getWalkableDirOf8Neighborhood(cell c);
  27. friend std::ostream& operator<<(std::ostream& os, const Grid &grid);
  28. private:
  29. GridOptions gridOptions;
  30. cells allGridCells;
  31. cells background;
  32. coordinates maxBoundaries;
  33. cell agent;
  34. cells adversaries;
  35. AgentNameAndPositionMap agentNameAndPositionMap;
  36. cells walls;
  37. cells floor;
  38. cells slipperyNorth;
  39. cells slipperyEast;
  40. cells slipperySouth;
  41. cells slipperyWest;
  42. cells lockedDoors;
  43. cells unlockedDoors;
  44. cells boxes;
  45. cells lava;
  46. cells goals;
  47. cells keys;
  48. std::map<Color, cells> backgroundTiles;
  49. std::map<coordinates, float> stateRewards;
  50. };