]> ruin.nu Git - icfp05.git/blobdiff - robbersrc/robber.cpp
lots of connections is a good thing
[icfp05.git] / robbersrc / robber.cpp
index 9bead891761960fd61654568996c0d043cdba3f3..5f36f475177f2a32072c62312ae445b93fbb5bb5 100644 (file)
@@ -22,26 +22,29 @@ string Robber::turn(){
                        //cerr << "Discarding: " << street->first << " since car is needed" << endl;
                        continue;
                }
-               double goodness = 0;
+               //cerr << "Looking at street: " << street->first << endl;
                Intersection& conInter = _intersections[street->first];
+               double goodness = conInter.connections.size()*5;
 
                list<string> closestFootCop = shortestPath(street->first, cop_foot, FindPlayer(_players, cop_foot, 6), true);
                unsigned int closestCop = closestFootCop.size();
-               //cerr << "Cop on fot " << closestCop << " intersections away." << endl;
                bool copInCar = false;
-               list<string> closestCarCop = shortestPath(street->first, cop_car, FindPlayer(_players, cop_car, closestCop > 0 ? closestCop : 5), true);
-               //cerr << "Cop in car " << closestCarCop.size() << " intersections away." << endl;
+               //cerr << "Cop on fot " << closestCop << " intersections away." << endl;
+
+               if (closestCop > 0 && closestCop < 3)
+                       continue;
 
+               list<string> closestCarCop = shortestPath(street->first, cop_car, FindPlayer(_players, cop_car, closestCop - 1 > 0 ? closestCop : 5), true);
+               //cerr << "Cop in car " << closestCarCop.size() << " intersections away." << endl;
 
                if (closestCarCop.size() > 0){
                        closestCop = closestCarCop.size();
                        copInCar = true;
                }
 
-               if (closestCop > 0 && closestCop < 3){
-                       //cerr << "Cop " << closestCop << " intersections away." << endl;
+               //cerr << "Cop " << closestCop << " intersections away." << endl;
+               if (closestCop > 0 && closestCop < 3)
                        continue;
-               }
 
                priority_queue<double> banks;
                for(hash_map<string,int>::const_iterator bank = _banks.begin();