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.

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