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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. int fTolerance;
  29. RepaintAgent(PictureEnvironment* iEnvironment, int iDotSize, int iMoveSize, int iTolerance);
  30. virtual void loop();
  31. virtual void move();
  32. virtual void paint();
  33. bool colorCloseEnough(sf::Uint32 iColor);
  34. protected:
  35. virtual void init();
  36. };
  37. class StraightPaintAgent : public RepaintAgent
  38. {
  39. public:
  40. StraightPaintAgent(PictureEnvironment* iEnvironment, int iDotSize, int iMoveSize, int iTolerance);
  41. protected:
  42. virtual void init();
  43. };
  44. class PullPaintAgent : public RepaintAgent
  45. {
  46. public:
  47. PullPaintAgent(PictureEnvironment* iEnvironment, int iDotSize, int iMoveSize);
  48. virtual void loop();
  49. virtual void move();
  50. };
  51. #endif // AGENT_H