La simu multi-agents qui repeint une image, mais en c++ Boilerplate pompé ici : https://github.com/andrew-r-king/sfml-vscode-boilerplate
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Agent.hpp 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. Agent();
  16. Agent(PictureEnvironment* iEnvironment, int iDotSize, int iMoveSize);
  17. virtual void loop();
  18. virtual void move();
  19. virtual void paint();
  20. };
  21. class RepaintAgent : public Agent
  22. {
  23. public:
  24. //list of possible movement vectors, to be used to perceive the environment
  25. std::vector<std::vector<int>> fMovements;
  26. std::vector<int> fValidMovementIndexes;
  27. std::vector<int> fCurrentMovement;
  28. RepaintAgent(PictureEnvironment* iEnvironment, int iDotSize, int iMoveSize);
  29. virtual void loop();
  30. virtual void move();
  31. virtual void paint();
  32. protected:
  33. virtual void init();
  34. };
  35. class StraightPaintAgent : public RepaintAgent
  36. {
  37. public:
  38. StraightPaintAgent(PictureEnvironment* iEnvironment, int iDotSize, int iMoveSize);
  39. protected:
  40. virtual void init();
  41. };
  42. class PullPaintAgent : public RepaintAgent
  43. {
  44. public:
  45. PullPaintAgent(PictureEnvironment* iEnvironment, int iDotSize, int iMoveSize);
  46. virtual void loop();
  47. virtual void move();
  48. };
  49. #endif // AGENT_H