Skip to content

Commit

Permalink
Mono climbing support
Browse files Browse the repository at this point in the history
  • Loading branch information
APN-Pucky committed Dec 12, 2017
1 parent 385190d commit 50cb313
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tyrant.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,20 @@ inline PassiveBGE::PassiveBGE passive_bge_name_to_id(const std::string& name_)
return PassiveBGE::no_bge;
}

inline Faction faction_name_to_id(const std::string& name_)
{
std::string name(name_);
name.erase(std::remove_if(name.begin(), name.end(), boost::is_any_of("-")), name.end()); //Mostly useless
for (unsigned i(allfactions); i < num_factions; ++i)
{
if (boost::iequals(faction_names[i], name))
{
return static_cast<Faction>(i);
}
}
return allfactions;
}

inline void map_keys_to_set(const std::unordered_map<unsigned, unsigned>& m, std::unordered_set<unsigned>& s)
{
for (auto it = m.begin(); it != m.end(); ++it)
Expand Down
11 changes: 11 additions & 0 deletions tyrant_optimize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ namespace {
std::unordered_map<unsigned, unsigned> owned_cards;
const Card* owned_alpha_dominion{nullptr};
bool use_owned_cards{true};
Faction faction = allfactions;
unsigned min_deck_len{1};
unsigned max_deck_len{10};
unsigned freezed_cards{0};
Expand Down Expand Up @@ -1293,6 +1294,11 @@ void hill_climbing(unsigned num_min_iterations, unsigned num_iterations, Deck* d
{
continue;
}
//mono
if(faction != allfactions && card->m_faction != faction)
{
continue;
}

// enqueue candidate according to category & type
if (card->m_type == CardType::commander)
Expand Down Expand Up @@ -2056,6 +2062,11 @@ int main(int argc, char** argv)
{
opt_keep_commander = true;
}
else if (strcmp(argv[argIndex], "mono") == 0 || strcmp(argv[argIndex], "-m") == 0)
{
faction = faction_name_to_id(argv[argIndex + 1]);
argIndex += 1;
}
else if (strcmp(argv[argIndex], "effect") == 0 || strcmp(argv[argIndex], "-e") == 0)
{
opt_effects[2].push_back(argv[argIndex + 1]);
Expand Down

0 comments on commit 50cb313

Please sign in to comment.