X-Git-Url: https://ruin.nu/git/?p=icfp05.git;a=blobdiff_plain;f=bot%2Fbot.cpp;h=28e8004a2167997f2b5a8bbe629a486ac03f6711;hp=713f1905657d4e16ac594297c57ac58a232e8597;hb=d7d9942fc9d1066670e166182e36791dfbf035d7;hpb=bce3d3b3c8b9f91f27000149fbd04f3a7f14800e diff --git a/bot/bot.cpp b/bot/bot.cpp index 713f190..28e8004 100644 --- a/bot/bot.cpp +++ b/bot/bot.cpp @@ -304,3 +304,27 @@ std::list Bot::shortestPath(const std::string& from, PlayerType typ return list(); } + +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& 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::const_iterator player = _players.begin(); + player != _players.end(); ++player){ + if (player->second.type == _type && player->second.location == node->name){ + return 1; + } + } + return 0; +}