X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=robbersrc%2Frobber.cpp;h=9bead891761960fd61654568996c0d043cdba3f3;hb=524573fae3ea0c8a1bb01a2b4fd848bff0bb04d1;hp=a9ab618d90cd144e81a4365a0f4a8b1110d097dd;hpb=87c4e6cccfbb55e5ac3f21f2787d54506f389dd4;p=icfp05.git diff --git a/robbersrc/robber.cpp b/robbersrc/robber.cpp index a9ab618..9bead89 100644 --- a/robbersrc/robber.cpp +++ b/robbersrc/robber.cpp @@ -8,6 +8,12 @@ using namespace std; using namespace __gnu_cxx; string Robber::turn(){ + + //Ignore bribing for now + cout << "nobribe:" << endl; + string input; + getline(cin,input); + hash_map streets; Intersection& inter = _intersections[_location]; for (hash_map::const_iterator street = inter.connections.begin(); @@ -20,16 +26,17 @@ string Robber::turn(){ Intersection& conInter = _intersections[street->first]; list closestFootCop = shortestPath(street->first, cop_foot, FindPlayer(_players, cop_foot, 6), true); - list closestCarCop = shortestPath(street->first, cop_car, FindPlayer(_players, cop_car, 5), true); - - unsigned int closestCop = 0; + unsigned int closestCop = closestFootCop.size(); + //cerr << "Cop on fot " << closestCop << " intersections away." << endl; bool copInCar = false; + list 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() < closestFootCop.size() && closestCarCop.size() > 0){ + + 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,13 +113,20 @@ string Robber::turn(){ } } _oldLocation = _location; + //cerr << "Moving to: " << destination << endl; return destination; } +void Robber::move(std::string location){ + cout << "rmov\\" << endl; + Bot::move(location); + cout << "nobribe:" << endl; + cout << "rmov/" << endl; +} int main(){ - Robber robber("robber"); + Robber robber("harv-robber"); robber.play(); return 0;