diff options
author | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 19:27:35 +0100 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 19:27:49 +0100 |
commit | 17909d029c6a8872b2fddf4e171d7925bbbe9c5c (patch) | |
tree | cbb08af84cd68d24acc362d593a2048b0fa79689 /Simulation/Guppie.hpp |
Diffstat (limited to 'Simulation/Guppie.hpp')
-rw-r--r-- | Simulation/Guppie.hpp | 58 |
1 files changed, 58 insertions, 0 deletions
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 <NeuralNet.hpp> +#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<float> eyeR = std::vector<float>(15, 0.f); + std::vector<float> eyeG = std::vector<float>(15, 0.f); + std::vector<float> eyeB = std::vector<float>(15, 0.f); + std::vector<float> touch = std::vector<float>(30, 0.f); +// std::vector<float> smell = std::vector<float>(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> 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__ |