]> ruin.nu Git - icfp05.git/blobdiff - bot/bot.cpp
some restructuring
[icfp05.git] / bot / bot.cpp
index 713f1905657d4e16ac594297c57ac58a232e8597..28e8004a2167997f2b5a8bbe629a486ac03f6711 100644 (file)
@@ -304,3 +304,27 @@ std::list<std::string> Bot::shortestPath(const std::string& from, PlayerType typ
        
        return list<string>();
 }
+
+SimpleSPGoal::SimpleSPGoal(std::string to):_to(to){
+}
+
+int SimpleSPGoal::operator()(const SPInfo* node) const{
+       if (node->name == _to)
+               return 1;
+       return 0;
+}
+
+FindPlayer::FindPlayer(const hash_map<string, Player>& players, PlayerType type, int limit) : _players(players), _type(type), _limit(limit){
+}
+
+int FindPlayer::operator()(const SPInfo* node) const{
+       if (_limit > 0 && node->cost >= _limit)
+               return -1;
+       for(hash_map<string, Player>::const_iterator player = _players.begin();
+                       player != _players.end(); ++player){
+               if (player->second.type == _type && player->second.location == node->name){
+                       return 1;
+               }
+       }
+       return 0;
+}