FuzzyEngines.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * FuzzyEngines.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include <fl/Headers.h>
  12. #include "../Goals/AbstractGoal.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class CArmedInstance;
  15. VCMI_LIB_NAMESPACE_END
  16. class engineBase //subclasses create fuzzylite variables with "new" that are not freed - this is desired as fl::Engine wants to destroy these...
  17. {
  18. protected:
  19. fl::Engine engine;
  20. fl::RuleBlock * rules;
  21. virtual void configure();
  22. void addRule(const std::string & txt);
  23. public:
  24. engineBase();
  25. };
  26. class TacticalAdvantageEngine : public engineBase //TODO: rework this engine, it does not work well (example: AI hero with 140 beholders attacked 150 beholders - engine lowered danger 50000 -> 35000)
  27. {
  28. public:
  29. TacticalAdvantageEngine();
  30. float getTacticalAdvantage(const CArmedInstance * we, const CArmedInstance * enemy); //returns factor how many times enemy is stronger than us
  31. private:
  32. fl::InputVariable * ourWalkers, *ourShooters, *ourFlyers, *enemyWalkers, *enemyShooters, *enemyFlyers;
  33. fl::InputVariable * ourSpeed, *enemySpeed;
  34. fl::InputVariable * bankPresent;
  35. fl::InputVariable * castleWalls;
  36. fl::OutputVariable * threat;
  37. };