]> ruin.nu Git - icfp05.git/blobdiff - bot/bot.h
some restructuring
[icfp05.git] / bot / bot.h
index 1c40b44214d8ae1eef0277e7796d37abc26c0d32..731a106a4a1dbcc847ee41f2fd65da03c1ac96dd 100644 (file)
--- a/bot/bot.h
+++ b/bot/bot.h
@@ -70,17 +70,6 @@ struct SPGoal{
        virtual int operator()(const SPInfo* node) const = 0;
 };
 
-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;
-       }
-};
-
 class Bot {
        public:
                Bot(const std::string& name, PlayerType type);
@@ -93,11 +82,13 @@ class Bot {
                void updateWorld();
                virtual std::string turn() = 0;
                void move(std::string location);
-               std::list<std::string> shortestPath(const std::string& from, PlayerType type, const SPGoal& goal);
+               void getPlayers();
+               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;
        __gnu_cxx::hash_map<std::string, int> _banks;
+       std::map<int, std::string> _evidence;
        std::map<PlayerType, std::string> _playerTypeNames;
        std::map<std::string, PlayerType> _playerTypes;
        std::string _name;
@@ -108,4 +99,18 @@ class Bot {
        int _smell;
 };
 
+struct SimpleSPGoal : public SPGoal{
+       std::string _to;
+       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