1 #ifndef BLOBS_CREATURE_GENOME_HPP_
2 #define BLOBS_CREATURE_GENOME_HPP_
4 #include "../math/Distribution.hpp"
5 #include "../math/GaloisLFSR.hpp"
28 PropertySet<T> props[6];
29 PropertySet<T> &Birth() noexcept { return props[0]; }
30 const PropertySet<T> &Birth() const noexcept { return props[0]; }
31 PropertySet<T> &Child() noexcept { return props[1]; }
32 const PropertySet<T> &Child() const noexcept { return props[1]; }
33 PropertySet<T> &Youth() noexcept { return props[2]; }
34 const PropertySet<T> &Youth() const noexcept { return props[2]; }
35 PropertySet<T> &Adult() noexcept { return props[3]; }
36 const PropertySet<T> &Adult() const noexcept { return props[3]; }
37 PropertySet<T> &Elder() noexcept { return props[4]; }
38 const PropertySet<T> &Elder() const noexcept { return props[4]; }
39 PropertySet<T> &Death() noexcept { return props[5]; }
40 const PropertySet<T> &Death() const noexcept { return props[5]; }
42 Properties<math::Distribution> properties;
48 // how much contained in the body
49 // relative value to determine average density
50 math::Distribution mass;
51 // how much to circulate
52 math::Distribution intake;
53 // how important for alive-being
54 math::Distribution penalty;
55 // how much off the mass may stay in the body
56 math::Distribution growth;
58 std::vector<Composition> composition;
60 math::Distribution base_hue;
61 math::Distribution base_saturation;
62 math::Distribution base_lightness;
64 void Configure(Creature &) const;
66 static PropertySet<double> Instantiate(
67 const PropertySet<math::Distribution> &p,
68 math::GaloisLFSR &rand
71 p.age.FakeNormal(rand.SNorm()),
72 p.mass.FakeNormal(rand.SNorm()),
73 p.fertility.FakeNormal(rand.SNorm())
77 static Properties<double> Instantiate(
78 const Properties<math::Distribution> &p,
79 math::GaloisLFSR &rand
82 Instantiate(p.props[0], rand),
83 Instantiate(p.props[1], rand),
84 Instantiate(p.props[2], rand),
85 Instantiate(p.props[3], rand),
86 Instantiate(p.props[4], rand),
87 Instantiate(p.props[5], rand)