FuzzyEngines.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #if __has_include(<fuzzylite/Headers.h>)
  12. # include <fuzzylite/Headers.h>
  13. #else
  14. # include <fl/Headers.h>
  15. #endif
  16. #include "../Goals/AbstractGoal.h"
  17. VCMI_LIB_NAMESPACE_BEGIN
  18. class CArmedInstance;
  19. VCMI_LIB_NAMESPACE_END
  20. namespace NKAI
  21. {
  22. class engineBase //subclasses create fuzzylite variables with "new" that are not freed - this is desired as fl::Engine wants to destroy these...
  23. {
  24. protected:
  25. fl::Engine engine;
  26. fl::RuleBlock * rules;
  27. virtual void configure();
  28. void addRule(const std::string & txt);
  29. public:
  30. engineBase();
  31. };
  32. 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)
  33. {
  34. public:
  35. TacticalAdvantageEngine();
  36. float getTacticalAdvantage(const CArmedInstance * we, const CArmedInstance * enemy); //returns factor how many times enemy is stronger than us
  37. private:
  38. fl::InputVariable * ourWalkers;
  39. fl::InputVariable * ourShooters;
  40. fl::InputVariable * ourFlyers;
  41. fl::InputVariable * enemyWalkers;
  42. fl::InputVariable * enemyShooters;
  43. fl::InputVariable * enemyFlyers;
  44. fl::InputVariable * ourSpeed;
  45. fl::InputVariable * enemySpeed;
  46. fl::InputVariable * bankPresent;
  47. fl::InputVariable * castleWalls;
  48. fl::OutputVariable * threat;
  49. };
  50. }