mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Uncommented Fuzzy code. Please let me know if it compiles on other platforms.
This commit is contained in:
parent
54c52869cf
commit
8be4ca03c8
@ -278,20 +278,21 @@ float FuzzyHelper::getTacticalAdvantage (const CArmedInstance *we, const CArmedI
|
||||
}
|
||||
|
||||
//shared_ptr<AbstractGoal> chooseSolution (std::vector<shared_ptr<AbstractGoal>> & vec)
|
||||
//{
|
||||
// typedef std::pair<shared_ptr<AbstractGoal>, float> goalValue;
|
||||
// std::vector <goalValue> values;
|
||||
//
|
||||
// for (auto g : vec)
|
||||
// {
|
||||
// values.push_back (std::make_pair(g, 66.6f));
|
||||
// }
|
||||
//
|
||||
// auto compareGoals = [&](const goalValue & lhs, const goalValue & rhs) -> bool
|
||||
// {
|
||||
// return lhs.second < rhs.second;
|
||||
// };
|
||||
//
|
||||
// boost::sort (values, compareGoals);
|
||||
// return values.end()->first;
|
||||
//}
|
||||
Goals::TSubgoal chooseSolution (Goals::TGoalVec & vec)
|
||||
{
|
||||
typedef std::pair<Goals::TSubgoal, float> goalValue;
|
||||
std::vector <goalValue> values;
|
||||
|
||||
for (auto g : vec)
|
||||
{
|
||||
values.push_back (std::make_pair(g, 66.6f));
|
||||
}
|
||||
|
||||
auto compareGoals = [&](const goalValue & lhs, const goalValue & rhs) -> bool
|
||||
{
|
||||
return lhs.second < rhs.second;
|
||||
};
|
||||
|
||||
boost::sort (values, compareGoals);
|
||||
return values.end()->first;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "../FuzzyLite/FuzzyLite.h"
|
||||
#include "Goals.h"
|
||||
|
||||
/*
|
||||
* Fuzzy.h, part of VCMI engine
|
||||
@ -44,7 +45,6 @@ public:
|
||||
ui64 estimateBankDanger (int ID);
|
||||
float getTacticalAdvantage (const CArmedInstance *we, const CArmedInstance *enemy); //returns factor how many times enemy is stronger than us
|
||||
|
||||
//FIXME: use Goals namespace
|
||||
//Goals::TSubgoal chooseSolution (Goals::TGoalVec & vec);
|
||||
Goals::TSubgoal chooseSolution (Goals::TGoalVec & vec);
|
||||
//shared_ptr<AbstractGoal> chooseSolution (std::vector<shared_ptr<AbstractGoal>> & vec);
|
||||
};
|
||||
|
@ -869,13 +869,19 @@ void CGoal<T>::accept (VCAI * ai)
|
||||
}
|
||||
|
||||
//TODO: find out why the following are not generated automatically on MVS?
|
||||
void CGoal<Win>::accept (VCAI * ai)
|
||||
{
|
||||
ai->tryRealize(static_cast<Win&>(*this));
|
||||
}
|
||||
|
||||
void CGoal<Build>::accept (VCAI * ai)
|
||||
{
|
||||
ai->tryRealize(static_cast<Build&>(*this));
|
||||
|
||||
namespace Goals
|
||||
{
|
||||
template <>
|
||||
void CGoal<Win>::accept (VCAI * ai)
|
||||
{
|
||||
ai->tryRealize(static_cast<Win&>(*this));
|
||||
}
|
||||
|
||||
template <>
|
||||
void CGoal<Build>::accept (VCAI * ai)
|
||||
{
|
||||
ai->tryRealize(static_cast<Build&>(*this));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user