Browse Source

introduced new slippery tiles

overwrites
sp 10 months ago
parent
commit
2e51e51320
  1. 6
      util/Grid.cpp
  2. 4
      util/Grid.h
  3. 7
      util/MinigridGrammar.h
  4. 7
      util/cell.h

6
util/Grid.cpp

@ -15,6 +15,10 @@ Grid::Grid(cells gridCells, cells background, const std::map<coordinates, float>
std::copy_if(background.begin(), background.end(), std::back_inserter(slipperyEast), [](cell c) { return c.type == Type::SlipperyEast; }); std::copy_if(background.begin(), background.end(), std::back_inserter(slipperyEast), [](cell c) { return c.type == Type::SlipperyEast; });
std::copy_if(background.begin(), background.end(), std::back_inserter(slipperySouth), [](cell c) { return c.type == Type::SlipperySouth; }); std::copy_if(background.begin(), background.end(), std::back_inserter(slipperySouth), [](cell c) { return c.type == Type::SlipperySouth; });
std::copy_if(background.begin(), background.end(), std::back_inserter(slipperyWest), [](cell c) { return c.type == Type::SlipperyWest; }); std::copy_if(background.begin(), background.end(), std::back_inserter(slipperyWest), [](cell c) { return c.type == Type::SlipperyWest; });
std::copy_if(background.begin(), background.end(), std::back_inserter(slipperyNorthWest), [](cell c) { return c.type == Type::SlipperyNorthWest; });
std::copy_if(background.begin(), background.end(), std::back_inserter(slipperyNorthEast), [](cell c) { return c.type == Type::SlipperyNorthEast; });
std::copy_if(background.begin(), background.end(), std::back_inserter(slipperySouthWest), [](cell c) { return c.type == Type::SlipperySouthWest; });
std::copy_if(background.begin(), background.end(), std::back_inserter(slipperySouthEast), [](cell c) { return c.type == Type::SlipperySouthEast; });
std::copy_if(gridCells.begin(), gridCells.end(), std::back_inserter(lockedDoors), [](cell c) { return c.type == Type::LockedDoor; }); std::copy_if(gridCells.begin(), gridCells.end(), std::back_inserter(lockedDoors), [](cell c) { return c.type == Type::LockedDoor; });
std::copy_if(gridCells.begin(), gridCells.end(), std::back_inserter(unlockedDoors), [](cell c) { return c.type == Type::Door; }); std::copy_if(gridCells.begin(), gridCells.end(), std::back_inserter(unlockedDoors), [](cell c) { return c.type == Type::Door; });
std::copy_if(gridCells.begin(), gridCells.end(), std::back_inserter(goals), [](cell c) { return c.type == Type::Goal; }); std::copy_if(gridCells.begin(), gridCells.end(), std::back_inserter(goals), [](cell c) { return c.type == Type::Goal; });
@ -157,7 +161,7 @@ void Grid::printToPrism(std::ostream& os, std::vector<Configuration>& configurat
std::map<std::string, cells> wallRestrictions = {{"North", northRestriction}, {"East", eastRestriction}, {"South", southRestriction}, {"West", westRestriction}}; std::map<std::string, cells> wallRestrictions = {{"North", northRestriction}, {"East", eastRestriction}, {"South", southRestriction}, {"West", westRestriction}};
std::map<std::string, cells> slipperyTiles = {{"North", slipperyNorth}, {"East", slipperyEast}, {"South", slipperySouth}, {"West", slipperyWest}};
std::map<std::string, cells> slipperyTiles = {{"North", slipperyNorth}, {"East", slipperyEast}, {"South", slipperySouth}, {"West", slipperyWest}, {"NorthWest", slipperyNorthWest}, {"NorthEast", slipperyNorthEast},{"SouthWest", slipperySouthWest},{"SouthEast", slipperySouthEast}};
std::vector<AgentName> agentNames; std::vector<AgentName> agentNames;
std::transform(agentNameAndPositionMap.begin(), std::transform(agentNameAndPositionMap.begin(),

4
util/Grid.h

@ -46,6 +46,10 @@ class Grid {
cells slipperyEast; cells slipperyEast;
cells slipperySouth; cells slipperySouth;
cells slipperyWest; cells slipperyWest;
cells slipperyNorthWest;
cells slipperyNorthEast;
cells slipperySouthWest;
cells slipperySouthEast;
cells lockedDoors; cells lockedDoors;
cells unlockedDoors; cells unlockedDoors;
cells boxes; cells boxes;

7
util/MinigridGrammar.h

@ -66,6 +66,10 @@ template <typename It>
("e", Type::SlipperyEast) ("e", Type::SlipperyEast)
("s", Type::SlipperySouth) ("s", Type::SlipperySouth)
("w", Type::SlipperyWest) ("w", Type::SlipperyWest)
("a", Type::SlipperyNorthWest)
("b", Type::SlipperyNorthEast)
("c", Type::SlipperySouthWest)
("d", Type::SlipperySouthEast)
("X", Type::Agent) ("X", Type::Agent)
("Z", Type::Adversary); ("Z", Type::Adversary);
color_.add color_.add
@ -74,8 +78,9 @@ template <typename It>
("B", Color::Blue) ("B", Color::Blue)
("P", Color::Purple) ("P", Color::Purple)
("Y", Color::Yellow) ("Y", Color::Yellow)
("W", Color::White)
(" ", Color::None); (" ", Color::None);
cell_ = type_ > color_; cell_ = type_ > color_;
row_ = (cell_ % -qi::char_("\n")); row_ = (cell_ % -qi::char_("\n"));

7
util/cell.h

@ -23,7 +23,11 @@ enum class Type : char {
SlipperyNorth = 'n', SlipperyNorth = 'n',
SlipperySouth = 's', SlipperySouth = 's',
SlipperyEast = 'e', SlipperyEast = 'e',
SlipperyWest = 'w'
SlipperyWest = 'w',
SlipperyNorthWest = 'a',
SlipperyNorthEast = 'b',
SlipperySouthWest = 'c',
SlipperySouthEast = 'd'
}; };
enum class Color : char { enum class Color : char {
Red = 'R', Red = 'R',
@ -31,6 +35,7 @@ enum class Color : char {
Blue = 'B', Blue = 'B',
Purple = 'P', Purple = 'P',
Yellow = 'Y', Yellow = 'Y',
White = 'W',
//Grey = 'G', //Grey = 'G',
None = ' ' None = ' '
}; };

Loading…
Cancel
Save