X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=bot%2Fbot.h;h=72d2d6bd7a88888bd3f9367dc3c783beac2c435b;hb=ea32d9ec2a34aa06cce2495c4efcb0864911be43;hp=7d278319332a6c9e2c416d9fa3d3f6aef5f34a41;hpb=f42b544842d9b9f21da3898225a70dec23c57a36;p=icfp05.git diff --git a/bot/bot.h b/bot/bot.h index 7d27831..72d2d6b 100644 --- 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 connections; - std::string type; + IntersectionType type; int x; int y; }; @@ -57,23 +57,38 @@ struct Bank{ template 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; +}; + 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 shortestPath(const std::string& from, const std::string& to, PlayerType type); + void getPlayers(); + 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; __gnu_cxx::hash_map _banks; + std::map _evidence; std::map _playerTypeNames; std::map _playerTypes; std::string _name; @@ -84,5 +99,15 @@ class Bot { int _smell; }; +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; + } +}; #endif