From 17909d029c6a8872b2fddf4e171d7925bbbe9c5c Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 29 Feb 2024 19:27:35 +0100 Subject: Initial commit --- Simulation/Guppie.hpp | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Simulation/Guppie.hpp (limited to 'Simulation/Guppie.hpp') diff --git a/Simulation/Guppie.hpp b/Simulation/Guppie.hpp new file mode 100644 index 0000000..14770ff --- /dev/null +++ b/Simulation/Guppie.hpp @@ -0,0 +1,58 @@ +#ifndef __GUPPIE_HPP__ +#define __GUPPIE_HPP__ + +#include +#include "Entity.hpp" + +class Guppie : public Entity +{ +public: + void startup(SimBase *sim); + void update(); + void draw(); + +private: + void destroy(); + void clean(); + + // State variables + bool isActive = false; + unsigned lifetime = 0; + double fitness = 0; + float energy = 0.f; + sf::Color skinColor; + enum gs { ALPHA = 0, BETTA = 1, GAMMA = 2 } glandState; +// float nGland1 = 0.f; +// float nGland2 = 0.f; +// float nGland3 = 0.f; + enum lc { ZAPPER, PELLET, CORPSE, GUPPIE } lastContact; + unsigned lastContactStep = 0; + + // Sensors + std::vector eyeR = std::vector(15, 0.f); + std::vector eyeG = std::vector(15, 0.f); + std::vector eyeB = std::vector(15, 0.f); + std::vector touch = std::vector(30, 0.f); +// std::vector smell = std::vector(30, 0.f); + float cColorR = 0.f, cColorG = 0.f, cColorB = 0.f; +// float cGland1 = 0.f, cGland2 = 0.f, cGland3 = 0.f; + float fwdSpeed = 0.f; + float sideSpeed = 0.f; + float rotation = 0.f; + float lowEnergy = 0.f; + + // Neural net + std::shared_ptr neuralNet; + + // Outputs + float thruster1 = 0.f, thruster2 = 0.f; + float addClrR = 0.f, addClrG = 0.f, addClrB = 0.f; +// float addGln1 = 0.f, addGln2 = 0.f, addGln3 = 0.f; + + friend class ContactListener; + friend class SimFitness; + friend class Entity; + friend class Camera; +}; + +#endif // __GUPPIE_HPP__ -- cgit v1.2.1