4 #include <ext/hash_map>
9 // These are needed to be able to use std::string as key in a hash_map.
11 template< typename CharT, typename Traits, typename Alloc >
12 struct hash< std::basic_string<CharT, Traits, Alloc> > {
13 size_t operator()(const std::basic_string<CharT, Traits, Alloc>& s) const {
15 const std::collate<CharT>& c = std::use_facet< std::collate<CharT> >(std::locale());
17 return c.hash(s.c_str(), s.c_str() + s.size());
23 template< typename CharT, typename Traits, typename Alloc >
24 struct hash< const std::basic_string<CharT, Traits, Alloc> > { //yes you need this version aswell!
26 size_t operator()(const std::basic_string<CharT, Traits, Alloc>& s) const {
28 const std::collate<CharT>& c = std::use_facet< std::collate<CharT> >(std::locale());
30 return c.hash(s.c_str(), s.c_str() + s.size());
36 enum StreetType{foot, car, both};
37 enum PlayerType{robber, cop_foot, cop_car};
38 enum IntersectionType{hq, bank, robber_start, ordinary};
41 __gnu_cxx::hash_map<std::string,StreetType> connections;
42 IntersectionType type;
58 T value(std::string input);
71 virtual int operator()(const SPInfo* node) const = 0;
76 Bot(const std::string& name, PlayerType type);
84 virtual std::string turn();
85 virtual void preGamePreparations(){};
86 virtual void move(std::string location);
87 virtual void sendInformation();
88 virtual void getInformation();
89 virtual void sendPlan();
90 virtual void getPlans();
92 virtual void voteResult();
94 std::list<std::string> shortestPath(const std::string& from, PlayerType type, const SPGoal& goal, bool reverse = false);
96 __gnu_cxx::hash_map<std::string, Intersection> _intersections;
97 __gnu_cxx::hash_map<std::string, Player> _players;
98 __gnu_cxx::hash_map<std::string, int> _banks;
99 std::map<int, std::string> _evidence;
100 std::map<PlayerType, std::string> _playerTypeNames;
101 std::map<std::string, PlayerType> _playerTypes;
104 std::string _location;
108 std::string _robberLocation;
110 __gnu_cxx::hash_map<std::string, int> _winningPlans;
113 class SimpleSPGoal : public SPGoal{
117 SimpleSPGoal(const std::string& to, int limit = 0);
118 int operator()(const SPInfo* node) const;
121 class FindPlayer : public SPGoal{
123 const __gnu_cxx::hash_map<std::string, Player>& _players;
126 FindPlayer(const __gnu_cxx::hash_map<std::string, Player>& players, PlayerType type, int limit = 0);
127 int operator()(const SPInfo* node) const;