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.4 KiB

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