+struct FindCop : SPGoal{
+ int _limit;
+ const hash_map<string, Player>& _players;
+ FindCop(const hash_map<string, Player>& players, int limit = 0) : _players(players), _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 != robber && player->second.location == node->name){
+ return 1;
+ }
+ }
+ return 0;
+ }
+};
+