virtual std::string turn() = 0;
void move(std::string location);
void getPlayers();
- std::list<std::string> shortestPath(const std::string& from, PlayerType type, const SPGoal& goal);
+ std::list<std::string> shortestPath(const std::string& from, PlayerType type, const SPGoal& goal, bool reverse = false);
__gnu_cxx::hash_map<std::string, Intersection> _intersections;
__gnu_cxx::hash_map<std::string, Player> _players;
struct SimpleSPGoal : public SPGoal{
std::string _to;
- SimpleSPGoal(std::string to):_to(to){};
- ~SimpleSPGoal(){}
- int operator()(const SPInfo* node) const{
- if (node->name == _to)
- return 1;
- return 0;
- }
+ SimpleSPGoal(std::string to);
+ int operator()(const SPInfo* node) const;
+};
+
+struct FindPlayer : SPGoal{
+ int _limit;
+ const __gnu_cxx::hash_map<std::string, Player>& _players;
+ PlayerType _type;
+ FindPlayer(const __gnu_cxx::hash_map<std::string, Player>& players, PlayerType type, int limit = 0);
+ int operator()(const SPInfo* node) const;
};
#endif