]> ruin.nu Git - icfp05.git/blobdiff - bot/bot.h
reading evidence
[icfp05.git] / bot / bot.h
index 7d278319332a6c9e2c416d9fa3d3f6aef5f34a41..efe373f77ed5c26890e19d2cd2360310636559fd 100644 (file)
--- a/bot/bot.h
+++ b/bot/bot.h
@@ -39,7 +39,7 @@ enum IntersectionType{hq, bank, robber_start, ordinary};
 
 struct Intersection{
        __gnu_cxx::hash_map<std::string,StreetType> connections;
-       std::string type;
+       IntersectionType type;
        int x;
        int y;
 };
@@ -57,23 +57,48 @@ struct Bank{
 template<class T>
 T value(std::string input);
 
+struct SPInfo{
+       std::string name;
+       bool settled;
+       SPInfo* parent;
+       int cost;
+};
+
+
+struct SPGoal{
+       virtual ~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);
-               virtual ~Bot();
+               virtual ~Bot(){};
 
                virtual void play();
 
        protected:
                void buildGraph();
                void updateWorld();
-               virtual std::string turn();
+               virtual std::string turn() = 0;
                void move(std::string location);
-               std::list<std::string> shortestPath(const std::string& from, const std::string& to, PlayerType type);
+               std::list<std::string> shortestPath(const std::string& from, PlayerType type, const SPGoal& goal);
 
        __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;
@@ -84,5 +109,4 @@ class Bot {
        int _smell;
 };
 
-
 #endif