FuzzyEngines.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. namespace NKAI
  17. {
  18. class engineBase //subclasses create fuzzylite variables with "new" that are not freed - this is desired as fl::Engine wants to destroy these...
  19. {
  20. protected:
  21. fl::Engine engine;
  22. fl::RuleBlock * rules;
  23. virtual void configure();
  24. void addRule(const std::string & txt);
  25. public:
  26. engineBase();
  27. };
  28. 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)
  29. {
  30. public:
  31. TacticalAdvantageEngine();
  32. float getTacticalAdvantage(const CArmedInstance * we, const CArmedInstance * enemy); //returns factor how many times enemy is stronger than us
  33. private:
  34. fl::InputVariable * ourWalkers, *ourShooters, *ourFlyers, *enemyWalkers, *enemyShooters, *enemyFlyers;
  35. fl::InputVariable * ourSpeed, *enemySpeed;
  36. fl::InputVariable * bankPresent;
  37. fl::InputVariable * castleWalls;
  38. fl::OutputVariable * threat;
  39. };
  40. }