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.

71 lines
1.8 KiB

11 months ago
11 months ago
  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. prism::ModelType getModelType() const;
  16. };
  17. class Grid {
  18. public:
  19. Grid(cells gridCells, cells background, const GridOptions &gridOptions, const std::map<coordinates, float> &stateRewards = {}, const double faultyProbability = 0);
  20. cells getGridCells();
  21. bool isBlocked(coordinates p);
  22. bool isWall(coordinates p);
  23. bool isLockedDoor(coordinates p);
  24. bool isUnlockedDoor(coordinates p);
  25. bool isKey(coordinates p);
  26. bool isBox(coordinates p);
  27. void printToPrism(std::ostream &os, std::vector<Configuration>& configuration, const prism::ModelType& modelType);
  28. void applyOverwrites(std::string& str, std::vector<Configuration>& configuration);
  29. std::array<bool, 8> getWalkableDirOf8Neighborhood(cell c);
  30. friend std::ostream& operator<<(std::ostream& os, const Grid &grid);
  31. private:
  32. GridOptions gridOptions;
  33. cells allGridCells;
  34. cells background;
  35. coordinates maxBoundaries;
  36. cell agent;
  37. cells adversaries;
  38. AgentNameAndPositionMap agentNameAndPositionMap;
  39. KeyNameAndPositionMap keyNameAndPositionMap;
  40. cells walls;
  41. cells floor;
  42. cells slipperyNorth;
  43. cells slipperyEast;
  44. cells slipperySouth;
  45. cells slipperyWest;
  46. cells lockedDoors;
  47. cells unlockedDoors;
  48. cells boxes;
  49. cells lava;
  50. cells goals;
  51. cells keys;
  52. std::map<Color, cells> backgroundTiles;
  53. std::map<coordinates, float> stateRewards;
  54. double faultyProbability;
  55. };