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"
30 PropertySet<T> props[6];
31 PropertySet<T> &Birth() noexcept { return props[0]; }
32 const PropertySet<T> &Birth() const noexcept { return props[0]; }
33 PropertySet<T> &Child() noexcept { return props[1]; }
34 const PropertySet<T> &Child() const noexcept { return props[1]; }
35 PropertySet<T> &Youth() noexcept { return props[2]; }
36 const PropertySet<T> &Youth() const noexcept { return props[2]; }
37 PropertySet<T> &Adult() noexcept { return props[3]; }
38 const PropertySet<T> &Adult() const noexcept { return props[3]; }
39 PropertySet<T> &Elder() noexcept { return props[4]; }
40 const PropertySet<T> &Elder() const noexcept { return props[4]; }
41 PropertySet<T> &Death() noexcept { return props[5]; }
42 const PropertySet<T> &Death() const noexcept { return props[5]; }
44 Properties<math::Distribution> properties;
50 // how much contained in the body
51 // relative value to determine average density
52 math::Distribution mass;
53 // how much to circulate
54 math::Distribution intake;
55 // how important for alive-being
56 math::Distribution penalty;
57 // how much off the mass may stay in the body
58 math::Distribution growth;
60 std::vector<Composition> composition;
62 math::Distribution base_hue;
63 math::Distribution base_saturation;
64 math::Distribution base_lightness;
66 void Configure(Creature &) const;
68 static PropertySet<double> Instantiate(
69 const PropertySet<math::Distribution> &p,
70 math::GaloisLFSR &rand
73 p.age.FakeNormal(rand.SNorm()),
74 p.mass.FakeNormal(rand.SNorm()),
75 p.fertility.FakeNormal(rand.SNorm()),
76 glm::clamp(p.highlight.FakeNormal(rand.SNorm()), 0.0, 1.0)
80 static Properties<double> Instantiate(
81 const Properties<math::Distribution> &p,
82 math::GaloisLFSR &rand
85 Instantiate(p.props[0], rand),
86 Instantiate(p.props[1], rand),
87 Instantiate(p.props[2], rand),
88 Instantiate(p.props[3], rand),
89 Instantiate(p.props[4], rand),
90 Instantiate(p.props[5], rand)