2012-07-01 02:48:40 +03:00
|
|
|
#pragma once
|
2014-09-02 16:29:28 +03:00
|
|
|
#include "fl/Headers.h"
|
2013-11-25 14:55:48 +03:00
|
|
|
#include "Goals.h"
|
2012-03-03 13:08:01 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Fuzzy.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
class VCAI;
|
2012-03-04 13:43:46 +03:00
|
|
|
class CArmedInstance;
|
2014-06-22 13:39:40 +03:00
|
|
|
class CBank;
|
2012-03-03 13:08:01 +03:00
|
|
|
|
|
|
|
class FuzzyHelper
|
|
|
|
{
|
|
|
|
friend class VCAI;
|
|
|
|
|
|
|
|
fl::FuzzyEngine engine;
|
2012-03-04 13:43:46 +03:00
|
|
|
|
2012-03-03 13:08:01 +03:00
|
|
|
fl::InputLVar* bankInput;
|
|
|
|
fl::OutputLVar* bankDanger;
|
2012-03-04 13:43:46 +03:00
|
|
|
fl::RuleBlock bankBlock;
|
|
|
|
|
2013-12-20 12:43:12 +03:00
|
|
|
class TacticalAdvantage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
fl::InputLVar * ourWalkers, * ourShooters, * ourFlyers, * enemyWalkers, * enemyShooters, * enemyFlyers;
|
|
|
|
fl::InputLVar * ourSpeed, * enemySpeed;
|
|
|
|
fl::InputLVar * bankPresent;
|
|
|
|
fl::InputLVar * castleWalls;
|
|
|
|
fl::OutputLVar * threat;
|
|
|
|
fl::RuleBlock tacticalAdvantage;
|
|
|
|
~TacticalAdvantage();
|
|
|
|
} ta;
|
|
|
|
|
|
|
|
class EvalVisitTile
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
fl::InputLVar * strengthRatio;
|
|
|
|
fl::InputLVar * heroStrength;
|
2014-02-07 11:23:31 +03:00
|
|
|
fl::InputLVar * turnDistance;
|
2013-12-20 12:43:12 +03:00
|
|
|
fl::InputLVar * missionImportance;
|
|
|
|
fl::OutputLVar * value;
|
|
|
|
fl::RuleBlock rules;
|
|
|
|
~EvalVisitTile();
|
|
|
|
} vt;
|
2012-03-03 13:08:01 +03:00
|
|
|
|
|
|
|
public:
|
2014-02-05 21:45:51 +03:00
|
|
|
enum RuleBlocks {BANK_DANGER, TACTICAL_ADVANTAGE, VISIT_TILE};
|
|
|
|
//blocks should be initialized in this order, which may be confusing :/
|
2012-03-04 13:43:46 +03:00
|
|
|
|
2012-03-03 13:08:01 +03:00
|
|
|
FuzzyHelper();
|
2012-03-04 13:43:46 +03:00
|
|
|
void initBank();
|
|
|
|
void initTacticalAdvantage();
|
2013-12-20 12:43:12 +03:00
|
|
|
void initVisitTile();
|
2012-03-04 13:43:46 +03:00
|
|
|
|
2013-12-19 23:21:21 +03:00
|
|
|
float evaluate (Goals::Explore & g);
|
|
|
|
float evaluate (Goals::RecruitHero & g);
|
|
|
|
float evaluate (Goals::VisitTile & g);
|
|
|
|
float evaluate (Goals::VisitHero & g);
|
|
|
|
float evaluate (Goals::BuildThis & g);
|
|
|
|
float evaluate (Goals::DigAtTile & g);
|
|
|
|
float evaluate (Goals::CollectRes & g);
|
|
|
|
float evaluate (Goals::Build & g);
|
2014-02-07 23:09:15 +03:00
|
|
|
float evaluate (Goals::GatherArmy & g);
|
2014-02-20 23:18:49 +03:00
|
|
|
float evaluate (Goals::ClearWayTo & g);
|
2013-12-19 23:21:21 +03:00
|
|
|
float evaluate (Goals::Invalid & g);
|
|
|
|
float evaluate (Goals::AbstractGoal & g);
|
2013-12-27 16:20:40 +03:00
|
|
|
void setPriority (Goals::TSubgoal & g);
|
2013-12-19 23:21:21 +03:00
|
|
|
|
2014-06-22 13:39:40 +03:00
|
|
|
ui64 estimateBankDanger (const CBank * bank);
|
2012-03-04 13:43:46 +03:00
|
|
|
float getTacticalAdvantage (const CArmedInstance *we, const CArmedInstance *enemy); //returns factor how many times enemy is stronger than us
|
2013-11-24 11:21:51 +03:00
|
|
|
|
2013-12-20 16:07:58 +03:00
|
|
|
Goals::TSubgoal chooseSolution (Goals::TGoalVec vec);
|
2013-11-24 11:21:51 +03:00
|
|
|
//shared_ptr<AbstractGoal> chooseSolution (std::vector<shared_ptr<AbstractGoal>> & vec);
|
2012-03-05 16:31:59 +03:00
|
|
|
};
|