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.

78 lines
4.8 KiB

1 year ago
  1. #pragma once
  2. #include <iostream>
  3. #include <functional>
  4. #include "MinigridGrammar.h"
  5. #include "PrismPrinter.h"
  6. namespace prism {
  7. class PrismModulesPrinter {
  8. public:
  9. PrismModulesPrinter(const ModelType &modelType, const size_t &numberOfPlayer);
  10. std::ostream& printRestrictionFormula(std::ostream& os, const AgentName &agentName, const std::string &direction, const cells &cells);
  11. std::ostream& printIsOnSlipperyFormula(std::ostream& os, const AgentName &agentName, const std::vector<std::reference_wrapper<cells>> &slipperyCollection);
  12. std::ostream& printGoalLabel(std::ostream& os, const AgentName&agentName, const cells &goals);
  13. std::ostream& printCrashLabel(std::ostream &os, const std::vector<AgentName> agentNames);
  14. std::ostream& printAvoidanceLabel(std::ostream &os, const std::vector<AgentName> agentNames, const int &distance);
  15. std::ostream& printKeysLabels(std::ostream& os, const AgentName&agentName, const cells &keys);
  16. std::ostream& printBackgroundLabels(std::ostream &os, const AgentName &agentName, const std::pair<Color, cells> &backgroundTiles);
  17. std::ostream& printIsInLavaFormula(std::ostream& os, const AgentName &agentName, const cells &lava);
  18. std::ostream& printFormulas(std::ostream& os,
  19. const AgentName&agentName,
  20. const cells &restrictionNorth,
  21. const cells &restrictionEast,
  22. const cells &restrictionSouth,
  23. const cells &restrictionWest,
  24. const std::vector<std::reference_wrapper<cells>> &slipperyCollection,
  25. const cells &lava);
  26. /*
  27. * Representation for Slippery Tile.
  28. * -) North: Slips from North to South
  29. * -) East: Slips from East to West
  30. * -) South: Slips from South to North
  31. * -) West: Slips from West to East
  32. */
  33. enum class SlipperyType { North, East, South, West };
  34. /*
  35. * Prints Slippery on move action.
  36. *
  37. * @param neighborhood: Information of wall-blocks in 8-neighborhood { n, nw, e, se, s, sw, w, nw }. If entry is false, then corresponding neighboorhood position is a wall.
  38. * @param orientation: Information of slippery type (either north, south, east, west).
  39. */
  40. std::ostream& printSlipperyMove(std::ostream &os, const AgentName &agentName, const size_t &agentIndex, const coordinates &c, std::set<std::string> &slipperyActions, const std::array<bool, 8>& neighborhood, SlipperyType orientation);
  41. /*
  42. * Prints Slippery on turn action.
  43. *
  44. * @param neighborhood: Information of wall-blocks in 8-neighborhood { n, nw, e, se, s, sw, w, nw }. If entry is false, then corresponding neighboorhood position is a wall.
  45. * @param orientation: Information of slippery type (either north, south, east, west).
  46. */
  47. std::ostream& printSlipperyTurn(std::ostream &os, const AgentName &agentName, const size_t &agentIndex, const coordinates &c, std::set<std::string> &slipperyActions, const std::array<bool, 8>& neighborhood, SlipperyType orientation);
  48. std::ostream& printModel(std::ostream &os, const ModelType &modelType);
  49. std::ostream& printBooleansForKeys(std::ostream &os, const cells &keys);
  50. std::ostream& printActionsForKeys(std::ostream &os, cells keys);
  51. std::ostream& printModule(std::ostream &os, const AgentName &agentName, const size_t &agentIndex, const coordinates &boundaries, const coordinates& initialPosition, const cells &keys, const bool agentWithView, const std::vector<float> &probabilities = {});
  52. std::ostream& printMovementActions(std::ostream &os, const AgentName &agentName, const size_t &agentIndex, const bool agentWithView, const float &probability = 1.0);
  53. std::ostream& printDoneActions(std::ostream &os, const AgentName &agentName, const size_t &agentIndex);
  54. std::ostream& printEndmodule(std::ostream &os);
  55. std::ostream& printPlayerStruct(std::ostream &os, const AgentName &agentName, const bool agentWithView, const std::vector<float> &probabilities = {}, const std::set<std::string> &slipperyActions = {});
  56. std::ostream& printGlobalMoveVariable(std::ostream &os, const size_t &numberOfPlayer);
  57. std::ostream& printRewards(std::ostream &os, const std::map<coordinates, float> &stateRewards, const cells &lava, const cells &goals);
  58. std::string moveGuard(const size_t &agentIndex);
  59. std::string moveUpdate(const size_t &agentIndex);
  60. std::string viewVariable(const AgentName &agentName, const size_t &agentDirection, const bool agentWithView);
  61. bool isGame() const;
  62. private:
  63. ModelType const& modelType;
  64. const size_t numberOfPlayer;
  65. };
  66. }