1 #ifndef BLOBS_CREATURE_GENOME_HPP_
2 #define BLOBS_CREATURE_GENOME_HPP_
4 #include "../math/Distribution.hpp"
5 #include "../math/GaloisLFSR.hpp"
6 #include "../math/glm.hpp"
23 /// every one of these should have at least one
24 /// negative impact to prevent super-beings evolving
26 /// power at the cost of higher solid intake
27 T &Strength() noexcept { return props[0]; }
28 const T &Strength() const noexcept { return props[0]; }
29 /// more endurance at the cost of higher liquid intake
30 T &Stamina() noexcept { return props[1]; }
31 const T &Stamina() const noexcept { return props[1]; }
32 /// more speed at the cost of higher fatigue
33 T &Dexerty() noexcept { return props[2]; }
34 const T &Dexerty() const noexcept { return props[2]; }
35 /// higher mental capacity at the cost of boredom
36 T &Intelligence() noexcept { return props[3]; }
37 const T &Intelligence() const noexcept { return props[3]; }
38 /// average lifetime in seconds
39 T &Lifetime() noexcept { return props[4]; }
40 const T &Lifetime() const noexcept { return props[4]; }
41 /// how likely to succeed in reproduction
42 T &Fertility() noexcept { return props[5]; }
43 const T &Fertility() const noexcept { return props[5]; }
44 /// how likely to mutate
45 T &Mutability() noexcept { return props[6]; }
46 const T &Mutability() const noexcept { return props[6]; }
47 /// how likely to adapt to new environments
48 T &Adaptability() noexcept { return props[7]; }
49 const T &Adaptability() const noexcept { return props[7]; }
51 T &OffspringMass() noexcept { return props[8]; }
52 const T &OffspringMass() const noexcept { return props[8]; }
54 Properties<math::Distribution> properties;
56 math::Distribution base_hue;
57 math::Distribution base_saturation;
58 math::Distribution base_lightness;
60 math::Distribution highlight_hue;
61 math::Distribution highlight_saturation;
62 math::Distribution highlight_lightness;
64 math::Distribution skin_back;
65 math::Distribution skin_side;
67 void Configure(Creature &) const;
69 static Properties<double> Instantiate(
70 const Properties<math::Distribution> &p,
71 math::GaloisLFSR &rand
74 p.props[0].FakeNormal(rand.SNorm()),
75 p.props[1].FakeNormal(rand.SNorm()),
76 p.props[2].FakeNormal(rand.SNorm()),
77 p.props[3].FakeNormal(rand.SNorm()),
78 p.props[4].FakeNormal(rand.SNorm()),
79 glm::clamp(p.props[5].FakeNormal(rand.SNorm()), 0.0, 1.0),
80 glm::clamp(p.props[6].FakeNormal(rand.SNorm()), 0.0, 1.0),
81 glm::clamp(p.props[7].FakeNormal(rand.SNorm()), 0.0, 1.0),
82 p.props[8].FakeNormal(rand.SNorm())