X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;ds=sidebyside;f=botsrc%2Fbot.h;h=aab4e831ea021ccbd610ae1c7a0e558aeaafaf69;hb=7ea4f9f073009ba9a6bbf2fec398b0742f798658;hp=731a106a4a1dbcc847ee41f2fd65da03c1ac96dd;hpb=e80a1fceda25988c576631be47a9b122126d8f53;p=icfp05.git diff --git a/botsrc/bot.h b/botsrc/bot.h index 731a106..aab4e83 100644 --- a/botsrc/bot.h +++ b/botsrc/bot.h @@ -65,9 +65,10 @@ struct SPInfo{ }; -struct SPGoal{ - virtual ~SPGoal(){} - virtual int operator()(const SPInfo* node) const = 0; +class SPGoal{ + public: + virtual ~SPGoal(){} + virtual int operator()(const SPInfo* node) const = 0; }; class Bot { @@ -80,35 +81,48 @@ class Bot { protected: void buildGraph(); void updateWorld(); - virtual std::string turn() = 0; - void move(std::string location); + virtual std::string turn(); + virtual void preGamePreparations(){}; + virtual void move(std::string location); + virtual void sendInformation(); + virtual void getInformation(); + virtual void sendPlan(); + virtual void getPlans(); + virtual void vote(); + virtual void voteResult(); 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; - PlayerType _type; - std::string _location; - int _world; - int _robbed; - int _smell; + __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; + PlayerType _type; + std::string _location; + int _world; + int _robbed; + int _smell; + std::string _robberLocation; + std::string _copHq; + __gnu_cxx::hash_map _winningPlans; }; -struct SimpleSPGoal : public SPGoal{ +class SimpleSPGoal : public SPGoal{ std::string _to; - SimpleSPGoal(std::string to); + int _limit; + public: + SimpleSPGoal(const std::string& to, int limit = 0); int operator()(const SPInfo* node) const; }; -struct FindPlayer : SPGoal{ +class FindPlayer : public SPGoal{ int _limit; const __gnu_cxx::hash_map& _players; PlayerType _type; + public: FindPlayer(const __gnu_cxx::hash_map& players, PlayerType type, int limit = 0); int operator()(const SPInfo* node) const; };