7 using namespace __gnu_cxx;
10 hash_map<string,double> streets;
11 Intersection& inter = _intersections[_location];
12 for (hash_map<string,StreetType>::const_iterator street = inter.connections.begin();
13 street != inter.connections.end(); ++street){
14 double goodness = 100;
15 int curx = _intersections[_location].x;
16 int cury = _intersections[_location].y;
18 int newx = _intersections[street->first].x;
19 int newy = _intersections[street->first].y;
20 for (hash_map<string, Player>::const_iterator player = _players.begin();
21 player != _players.end(); ++player){
22 if (player->first == _name)
25 int px = _intersections[player->second.location].x;
26 int py = _intersections[player->second.location].y;
28 double dist1 = sqrt(pow((curx-px),2.0)+pow((cury-py),2.0));
29 double dist2 = sqrt(pow((newx-px),2.0)+pow((newy-py),2.0));
30 cerr << "Original distance: " << dist1 << endl;
31 cerr << "New distance: " << dist2 << endl;
39 if (player->second.type == "cop-foot" && dist2 <= 3)
41 else if (player->second.type == "cop-car" && dist2 <= 2)
46 streets[street->first] = goodness;
49 for(hash_map<string,int>::const_iterator bank = _banks.begin();
50 bank != _banks.end(); ++bank){
51 //cerr << "Handling bank at: " << bank->first << endl;
52 if (bank->second > 0){
53 vector<string> v = shortestPath(_location, bank->first,_type);
56 streets[v[1]] *= bank->second/v.size();
60 /*cerr << "Using route: ";
61 copy(v.begin(), v.end(), ostream_iterator<string>(cerr, " : "));
67 for (hash_map<string,double>::const_iterator dest = streets.begin();
68 dest != streets.end(); ++dest){
69 cerr << "Goodness: " << dest->second << endl;
70 if (dest->second > goodness){
71 cerr << "New Goodness: " << dest->second << endl;
72 goodness = dest->second;
73 destination = dest->first;
82 Robber robber("robber");