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.

68 lines
3.6 KiB

2 months ago
  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 &lockedDoors, const cells &unlockedDoors, const cells &keys, const std::map<std::string, cells> &slipperyTiles, const cells &lava, const cells &goals, const AgentNameAndPositionMap &agentNameAndPositionMap, const bool faulty);
  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 printRelativeIsInFrontOfFormulaWithCondition(const AgentName &agentName, const std::string &reason, const std::string &condition);
  27. void printSlipRestrictionFormula(const AgentName &agentName, const std::string &direction);
  28. void printCollisionFormula(const std::string &agentName);
  29. void printCollisionLabel();
  30. void printInitStruct();
  31. private:
  32. std::string buildFormula(const std::string &formulaName, const std::string &formula, const bool semicolon = true);
  33. std::string buildLabel(const std::string &labelName, const std::string &label);
  34. std::string buildDisjunction(const AgentName &agentName, const std::map<ViewDirection, coordinates> &cells);
  35. std::string buildDisjunction(const AgentName &agentName, const cells &cells);
  36. std::string buildDisjunction(const AgentName &agentName, const std::string &reason);
  37. std::string buildDisjunction(const AgentName &agentName, const cells &cells, const std::pair<int, int> &offset);
  38. bool slipperyBehaviour() const;
  39. bool anyPortableObject() const;
  40. std::ostream &os;
  41. std::map<std::string, cells> restrictions;
  42. cells walls;
  43. cells lockedDoors;
  44. cells unlockedDoors;
  45. cells keys;
  46. std::map<std::string, cells> slipperyTiles;
  47. cells lava;
  48. cells goals;
  49. AgentNameAndPositionMap agentNameAndPositionMap;
  50. std::vector<std::string> conditionalMovementRestrictions;
  51. std::vector<std::string> portableObjects;
  52. bool faulty;
  53. };
  54. }