56 lines
977 B
C++

#ifndef DNA_H
#define DNA_H
#include <cinttypes>
#include <array>
#include "values/mrand.hpp"
#define MAX_DEPTH 8
#define MAX_POSIBLE_DEPTH 11
static_assert(MAX_DEPTH <= MAX_POSIBLE_DEPTH);
struct Branch
{
uint8_t colorR;
uint8_t colorG;
uint8_t colorB;
int8_t colorR_change;
int8_t colorG_change;
int8_t colorB_change;
uint8_t colorVar;
uint8_t size;
uint8_t sizeParent;
uint8_t sizeLevel;
uint8_t sizeChange;
uint8_t sizeVar;
uint8_t length;
uint8_t lengthVar;
uint8_t branchCount;
uint8_t branchAngleVar;
};
struct Dna
{
uint128 mountenSeed;
uint128 starSeed;
uint128 branchSeed;
uint8_t moonX;
uint8_t moonY;
uint8_t moonSize;
uint8_t colorSet;
Branch branches[MAX_DEPTH];
};
namespace DNA
{
void newDna(Dna *dna, uint128 *state);
void makeChild(Dna *p1, Dna *p2, Dna *c, uint128 *state);
void clone(Dna *p1, Dna *c, uint128 *state);
void mutate(Dna *dna, uint32_t num, uint128 *state);
}
#endif /* DNA_H */