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)
+ if (_limit > 0 && node->cost >= _limit)
return -1;
for(hash_map<string, Player>::const_iterator player = _players.begin();
player != _players.end(); ++player){
double goodness = 10;
Intersection& conInter = _intersections[street->first];
+ list<string> l = shortestPath(street->first, _type, FindCop(_players, 5));
+ if (l.size() > 0){
+ cerr << "Cop " << l.size() << " intersections away." << endl;
+ goodness *= 1 - 1/(6 - l.size());
+ }
+
if (conInter.type == bank){
cerr << "FOUND A BANK" << endl;
- list<string> l = shortestPath(_location, _type, FindCop(_players, 3));
- if (l.size() > 0){
- cerr << "Cop " << l.size() << " intersections away." << endl;
+ if (l.size() > 0 && l.size() < 4)
goodness = 0;
- }else if (_banks[street->first] > 0){
+ else if (_banks[street->first] != 0){
cerr << "No cop close to bank" << endl;
return street->first;
}