diff --git a/util/PrismModulesPrinter.cpp b/util/PrismModulesPrinter.cpp index 6334ea7..4e73af2 100644 --- a/util/PrismModulesPrinter.cpp +++ b/util/PrismModulesPrinter.cpp @@ -62,6 +62,10 @@ namespace prism { printRobotModule(agentName, initialPosition); } + if(agentNameAndPositionMap.size() > 1) { + printMoveModule(); + } + if(faultyBehaviour()) { for(const auto [agentName, initialPosition] : agentNameAndPositionMap) { printFaultyMovementModule(agentName); @@ -475,52 +479,24 @@ namespace prism { } os << "\n"; - - return os; } - std::ostream& PrismModulesPrinter::printDoneActions(std::ostream &os, const AgentName &agentName) { + void PrismModulesPrinter::printDoneActions(const AgentName &agentName) { os << "\t[" << agentName << "_done]" << moveGuard(agentName) << agentName << "IsInGoal | " << agentName << "IsInLava -> (" << agentName << "Done'=true);\n"; - return os; } - std::ostream& PrismModulesPrinter::printPlayerStruct(std::ostream &os, const AgentName &agentName, const bool agentWithView, const std::vector &probabilities, const std::set &slipperyActions) { + void PrismModulesPrinter::printPlayerStruct(const AgentName &agentName, const std::vector &probabilities, const std::set &slipperyActions) { os << "player " << agentName << "\n\t"; bool first = true; - std::list allActions = { "_move_north", "_move_east", "_move_south", "_move_west" }; - std::list movementActions = allActions; - for(auto const& probability : probabilities) { - std::string percentageString = std::to_string((int)(100 * probability)); - for(auto const& movement : movementActions) { - allActions.push_back(movement + "_" + percentageString); - } - } - if(agentWithView) { - allActions.push_back("_turn_left"); - allActions.push_back("_turn_right"); - } else { - allActions.push_back("_turns"); - } - - for(auto const& action : allActions) { - if(first) first = false; else os << ", "; - os << "[" << agentName << action << "]"; - } - for(auto const& action : slipperyActions) { - os << ", " << action; + for(const auto [actionId, actionName] : agentNameActionMap.at(agentName)) { + if(first) first = false; + else os << ", "; + os << actionName; } - - os << ", [" << agentName << "_done]"; os << "\nendplayer\n"; - return os; } - std::ostream& PrismModulesPrinter::printGlobalMoveVariable(std::ostream &os, const size_t &numberOfPlayer) { - os << "\nglobal move : [0.." << std::to_string(numberOfPlayer - 1) << "];\n\n"; - return os; - } - - std::ostream& PrismModulesPrinter::printRewards(std::ostream &os, const AgentName &agentName, const std::map &stateRewards, const cells &lava, const cells &goals, const std::map &backgroundTiles) { + void PrismModulesPrinter::printRewards(const AgentName &agentName, const std::map &stateRewards, const cells &lava, const cells &goals, const std::map &backgroundTiles) { if(lava.size() != 0) { os << "rewards \"" << agentName << "SafetyNoBFS\"\n"; os << "\t" <