]> ruin.nu Git - icfp05.git/commitdiff
fixed a bug and some reordering
authorMichael Andreen <harv@ruin.nu>
Fri, 8 Jul 2005 18:43:40 +0000 (18:43 +0000)
committerMichael Andreen <harv@ruin.nu>
Fri, 8 Jul 2005 18:43:40 +0000 (18:43 +0000)
robbersrc/robber.cpp

index 50db5100faf9b561a99a9f451ca319e4b71b9f05..abf638b1c1f0c9f4107d3e3f415207bcd5d391b6 100644 (file)
@@ -20,16 +20,17 @@ string Robber::turn(){
                Intersection& conInter = _intersections[street->first];
 
                list<string> closestFootCop = shortestPath(street->first, cop_foot, FindPlayer(_players, cop_foot, 6), true);
-               list<string> closestCarCop = shortestPath(street->first, cop_car, FindPlayer(_players, cop_car, closestFootCop.size() - 1), true);
-
-               unsigned int closestCop = 0;
+               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;
+
 
                if (closestCarCop.size() > 0){
                        closestCop = closestCarCop.size();
                        copInCar = true;
-               }else 
-                       closestCop = closestFootCop.size();
+               }
 
                if (closestCop > 0 && closestCop < 3){
                        //cerr << "Cop " << closestCop << " intersections away." << endl;
@@ -106,6 +107,7 @@ string Robber::turn(){
                }
        }
        _oldLocation = _location;
+       //cerr << "Moving to: " << destination << endl;
                
        return destination;