public void Init() { // 0 Forward // 1 Left // 2 Right // Here its going to generate a no. from 0-3 // This no. will make the Bot move accordingly bot_DNA = new CapsuleDNA(DNALength, 3); LifeSpan = 0; StartPos = transform.position; Alive = true; }
public void OffSpringGen(CapsuleDNA parent1, CapsuleDNA parent2) { for (int i = 0; i < DNALength; i++) { // OffSprings is made in such a way that, it has half of its genes from Parent1 and the other half from the Parent2 if (i < (DNALength / 2.0f)) { int c = parent1.Genes[i]; Genes[i] = c; } else { int c = parent2.Genes[i]; Genes[i] = c; } } }