diff --git a/util/Grid.cpp b/util/Grid.cpp index 8a02c5e..d87fcc0 100644 --- a/util/Grid.cpp +++ b/util/Grid.cpp @@ -7,7 +7,7 @@ Grid::Grid(cells gridCells, cells background, const std::map : allGridCells(gridCells), background(background), stateRewards(stateRewards), probIntended(probIntended), faultyProbability(faultyProbability) { cell max = allGridCells.at(allGridCells.size() - 1); - maxBoundaries = std::make_pair(max.row - 1, max.column - 1); + maxBoundaries = std::make_pair(max.column - 1, max.row - 1); std::copy_if(gridCells.begin(), gridCells.end(), std::back_inserter(walls), [](cell c) { return c.type == Type::Wall; }); std::copy_if(gridCells.begin(), gridCells.end(), std::back_inserter(lava), [](cell c) { return c.type == Type::Lava; }); std::copy_if(gridCells.begin(), gridCells.end(), std::back_inserter(floor), [](cell c) { return c.type == Type::Floor; }); // TODO CHECK IF ALL AGENTS ARE ADDED TO FLOOR diff --git a/util/PrismModulesPrinter.cpp b/util/PrismModulesPrinter.cpp index ad8617c..fb1803a 100644 --- a/util/PrismModulesPrinter.cpp +++ b/util/PrismModulesPrinter.cpp @@ -104,8 +104,8 @@ namespace prism { void PrismModulesPrinter::printPortableObjectModule(const cell &object) { std::string identifier = capitalize(object.getColor()) + object.getType(); os << "\nmodule " << identifier << std::endl; - os << " x" << identifier << " : [-1.." << maxBoundaries.second << "] init " << object.column << ";\n"; - os << " y" << identifier << " : [-1.." << maxBoundaries.first << "] init " << object.row << ";\n"; + os << " col" << identifier << " : [-1.." << maxBoundaries.first << "] init " << object.column << ";\n"; + os << " row" << identifier << " : [-1.." << maxBoundaries.second << "] init " << object.row << ";\n"; os << " " << identifier << "PickedUp : bool;\n"; os << "\n"; @@ -118,19 +118,19 @@ namespace prism { void PrismModulesPrinter::printPortableObjectActions(const std::string &agentName, const std::string &identifier) { std::string actionName = "[" + agentName + "_pickup_" + identifier + "]"; agentNameActionMap.at(agentName).insert({NOFAULT, actionName}); - os << " " << actionName << " true -> (x" << identifier << "'=-1) & (y" << identifier << "'=-1) & (" << identifier << "PickedUp'=true);\n"; + os << " " << actionName << " true -> (col" << identifier << "'=-1) & (row" << identifier << "'=-1) & (" << identifier << "PickedUp'=true);\n"; actionName = "[" + agentName + "_drop_" + identifier + "_north]"; agentNameActionMap.at(agentName).insert({NOFAULT, actionName}); - os << " " << actionName << " " << " true -> (x" << identifier << "'=x" << agentName << ") & (y" << identifier << "'=y" << agentName << "-1) & (" << identifier << "PickedUp'=false);\n"; + os << " " << actionName << " " << " true -> (col" << identifier << "'=col" << agentName << ") & (row" << identifier << "'=row" << agentName << "-1) & (" << identifier << "PickedUp'=false);\n"; actionName = "[" + agentName + "_drop_" + identifier + "_west]"; agentNameActionMap.at(agentName).insert({NOFAULT, actionName}); - os << " " << actionName << " " << " true -> (x" << identifier << "'=x" << agentName << "-1) & (y" << identifier << "'=y" << agentName << ") & (" << identifier << "PickedUp'=false);\n"; + os << " " << actionName << " " << " true -> (col" << identifier << "'=col" << agentName << "-1) & (row" << identifier << "'=row" << agentName << ") & (" << identifier << "PickedUp'=false);\n"; actionName = "[" + agentName + "_drop_" + identifier + "_south]"; agentNameActionMap.at(agentName).insert({NOFAULT, actionName}); - os << " " << actionName << " " << " true -> (x" << identifier << "'=x" << agentName << ") & (y" << identifier << "'=y" << agentName << "+1) & (" << identifier << "PickedUp'=false);\n"; + os << " " << actionName << " " << " true -> (col" << identifier << "'=col" << agentName << ") & (row" << identifier << "'=row" << agentName << "+1) & (" << identifier << "PickedUp'=false);\n"; actionName = "[" + agentName + "_drop_" + identifier + "_east]"; agentNameActionMap.at(agentName).insert({NOFAULT, actionName}); - os << " " << actionName << " " << " ttrue -> (x" << identifier << "'=x" << agentName << "+1) & (y" << identifier << "'=y" << agentName << ") & (" << identifier << "PickedUp'=false);\n"; + os << " " << actionName << " " << " true -> (col" << identifier << "'=col" << agentName << "+1) & (row" << identifier << "'=row" << agentName << ") & (" << identifier << "PickedUp'=false);\n"; } void PrismModulesPrinter::printDoorModule(const cell &door, const bool &opened) { @@ -171,8 +171,8 @@ namespace prism { void PrismModulesPrinter::printRobotModule(const AgentName &agentName, const coordinates &initialPosition) { os << "\nmodule " << agentName << std::endl; - os << " col" << agentName << " : [1.." << maxBoundaries.second << "] init " << initialPosition.second << ";\n"; - os << " row" << agentName << " : [1.." << maxBoundaries.first << "] init " << initialPosition.first << ";\n"; + os << " col" << agentName << " : [1.." << maxBoundaries.first << "] init " << initialPosition.first << ";\n"; + os << " row" << agentName << " : [1.." << maxBoundaries.second << "] init " << initialPosition.second << ";\n"; os << " view" << agentName << " : [0..3] init 1;\n"; printTurnActionsForRobot(agentName);