]> ruin.nu Git - icfp05.git/commitdiff
tuned robber a bit
authorMichael Andreen <harv@ruin.nu>
Sun, 26 Jun 2005 10:50:16 +0000 (10:50 +0000)
committerMichael Andreen <harv@ruin.nu>
Sun, 26 Jun 2005 10:50:16 +0000 (10:50 +0000)
robber/robber.cpp

index d8154c09705aaca0dd5957dfbf8370fcbcfaecd1..87ef6454fee9985e125debb241bc09984f0c7753 100644 (file)
@@ -11,7 +11,7 @@ struct FindCop : SPGoal{
        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){
@@ -35,13 +35,17 @@ string Robber::turn(){
                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;
                        }