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.

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