X-Git-Url: https://ruin.nu/git/?p=icfp05.git;a=blobdiff_plain;f=bot%2Fbot.h;h=731a106a4a1dbcc847ee41f2fd65da03c1ac96dd;hp=d01ec114853e118456235efea29b4650d8d268c5;hb=d7d9942fc9d1066670e166182e36791dfbf035d7;hpb=0fbd9bca7cd5cd937f306753f895cfe642dd9e6d diff --git a/bot/bot.h b/bot/bot.h index d01ec11..731a106 100644 --- a/bot/bot.h +++ b/bot/bot.h @@ -83,7 +83,7 @@ class Bot { virtual std::string turn() = 0; void move(std::string location); void getPlayers(); - std::list shortestPath(const std::string& from, PlayerType type, const SPGoal& goal); + std::list shortestPath(const std::string& from, PlayerType type, const SPGoal& goal, bool reverse = false); __gnu_cxx::hash_map _intersections; __gnu_cxx::hash_map _players; @@ -101,13 +101,16 @@ class Bot { 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& _players; + PlayerType _type; + FindPlayer(const __gnu_cxx::hash_map& players, PlayerType type, int limit = 0); + int operator()(const SPInfo* node) const; }; #endif