La simu multi-agents qui repeint une image, mais en c++ Boilerplate pompé ici : https://github.com/andrew-r-king/sfml-vscode-boilerplate
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef AGENT_H
  2. #define AGENT_H
  3. #include <Agents/Perception/Perception.hpp>
  4. #include <Environment/PictureEnvironment.hpp>
  5. class Agent
  6. {
  7. public:
  8. Perception fCurrentPerception;
  9. PictureEnvironment* fEnvironment;
  10. sf::Color fColor;
  11. int fDotSize;
  12. int fMoveSize;
  13. int fXPos;
  14. int fYPos;
  15. int fEnvWidth;
  16. int fEnvHeight;
  17. Agent();
  18. Agent(PictureEnvironment* iEnvironment, int iDotSize, int iMoveSize);
  19. virtual void loop();
  20. virtual void move();
  21. virtual void paint();
  22. };
  23. class RepaintAgent : public Agent
  24. {
  25. public:
  26. //list of possible movement vectors, to be used to perceive the environment
  27. std::vector<std::vector<int>> fMovements;
  28. std::vector<int> fValidMovementIndexes;
  29. std::vector<int> fCurrentMovement;
  30. int fTolerance;
  31. RepaintAgent(PictureEnvironment* iEnvironment, int iDotSize, int iMoveSize, int iTolerance);
  32. virtual void loop();
  33. virtual void move();
  34. virtual void paint();
  35. bool colorCloseEnough(sf::Uint32 iColor);
  36. protected:
  37. virtual void init();
  38. };
  39. class StraightPaintAgent : public RepaintAgent
  40. {
  41. public:
  42. StraightPaintAgent(PictureEnvironment* iEnvironment, int iDotSize, int iMoveSize, int iTolerance);
  43. protected:
  44. virtual void init();
  45. };
  46. class PullPaintAgent : public RepaintAgent
  47. {
  48. public:
  49. PullPaintAgent(PictureEnvironment* iEnvironment, int iDotSize, int iMoveSize);
  50. virtual void loop();
  51. virtual void move();
  52. };
  53. #endif // AGENT_H