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.

61 lines
3.4 KiB

  1. #pragma once
  2. #include <iostream>
  3. #include <functional>
  4. #include "MinigridGrammar.h"
  5. #include "PrismPrinter.h"
  6. #include "ConfigYaml.h"
  7. std::string oneOffToString(const int &offset);
  8. std::string vectorToDisjunction(const std::vector<std::string> &formulae);
  9. std::string cellToConjunction(const AgentName &agentName, const cell &c);
  10. std::string cellToConjunctionWithOffset(const AgentName &agentName, const cell &c, const std::string &xOffset, const std::string &yOffset);
  11. std::string coordinatesToConjunction(const AgentName &agentName, const coordinates &c, const ViewDirection viewDirection);
  12. std::string objectPositionToConjunction(const AgentName &agentName, const std::string &identifier, const std::pair<int, int> &relativePosition);
  13. std::string objectPositionToConjunction(const AgentName &agentName, const std::string &identifier, const std::pair<int, int> &relativePosition, const ViewDirection viewDirection);
  14. std::map<ViewDirection, coordinates> getAdjacentCells(const cell &c);
  15. std::map<ViewDirection, std::pair<int, int>> getRelativeAdjacentCells();
  16. std::map<std::string, std::pair<int, int>> getRelativeSurroundingCells();
  17. namespace prism {
  18. class PrismFormulaPrinter {
  19. public:
  20. PrismFormulaPrinter(std::ostream &os, const std::map<std::string, cells> &restrictions, const cells &walls, const cells &boxes, const cells &balls, const cells &lockedDoors, const cells &unlockedDoors, const cells &keys, const std::map<std::string, cells> &slipperyTiles, const cells &lava, const cells &goals);
  21. void print(const AgentName &agentName);
  22. void printRestrictionFormula(const AgentName &agentName, const std::string &direction, const cells &grid_cells);
  23. void printIsOnFormula(const AgentName &agentName, const std::string &type, const cells &grid_cells, const std::string &direction = "");
  24. void printIsNextToFormula(const AgentName &agentName, const std::string &type, const std::map<ViewDirection, coordinates> &coordinates);
  25. void printRestrictionFormulaWithCondition(const AgentName &agentName, const std::string &reason, const std::map<ViewDirection, coordinates> &coordinates, const std::string &condition);
  26. void printRelativeRestrictionFormulaWithCondition(const AgentName &agentName, const std::string &reason, const std::string &condition);
  27. void printSlipRestrictionFormula(const AgentName &agentName, const std::string &direction);
  28. private:
  29. std::string buildFormula(const std::string &formulaName, const std::string &formula, const bool semicolon = true);
  30. std::string buildLabel(const std::string &labelName, const std::string &label);
  31. std::string buildDisjunction(const AgentName &agentName, const std::map<ViewDirection, coordinates> &cells);
  32. std::string buildDisjunction(const AgentName &agentName, const cells &cells);
  33. std::string buildDisjunction(const AgentName &agentName, const std::string &reason);
  34. std::string buildDisjunction(const AgentName &agentName, const cells &cells, const std::pair<int, int> &offset);
  35. bool slipperyBehaviour() const;
  36. bool anyPortableObject() const;
  37. std::ostream &os;
  38. std::map<std::string, cells> restrictions;
  39. cells walls;
  40. cells boxes;
  41. cells balls;
  42. cells lockedDoors;
  43. cells unlockedDoors;
  44. cells keys;
  45. std::map<std::string, cells> slipperyTiles;
  46. cells lava;
  47. cells goals;
  48. std::vector<std::string> conditionalMovementRestrictions;
  49. std::vector<std::string> portableObjects;
  50. };
  51. }