return list<string>();
}
+
+SimpleSPGoal::SimpleSPGoal(std::string to):_to(to){
+}
+
+int SimpleSPGoal::operator()(const SPInfo* node) const{
+ if (node->name == _to)
+ return 1;
+ return 0;
+}
+
+FindPlayer::FindPlayer(const hash_map<string, Player>& players, PlayerType type, int limit) : _players(players), _type(type), _limit(limit){
+}
+
+int FindPlayer::operator()(const SPInfo* node) const{
+ if (_limit > 0 && node->cost >= _limit)
+ return -1;
+ for(hash_map<string, Player>::const_iterator player = _players.begin();
+ player != _players.end(); ++player){
+ if (player->second.type == _type && player->second.location == node->name){
+ return 1;
+ }
+ }
+ return 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;
- }
+ 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
using namespace std;
using namespace __gnu_cxx;
-struct FindPlayer : SPGoal{
- int _limit;
- const hash_map<string, Player>& _players;
- PlayerType _type;
- FindPlayer(const hash_map<string, Player>& players, PlayerType type, int limit = 0) : _players(players), _type(type), _limit(limit){}
- int operator()(const SPInfo* node) const{
- if (_limit > 0 && node->cost >= _limit)
- return -1;
- for(hash_map<string, Player>::const_iterator player = _players.begin();
- player != _players.end(); ++player){
- if (player->second.type == _type && player->second.location == node->name){
- return 1;
- }
- }
- return 0;
- }
-};
-
string Robber::turn(){
hash_map<string,double> streets;
Intersection& inter = _intersections[_location];