Пример #1
0
    public void Combine(CDNA d1, CDNA d2)
    {
        for (int i = 0; i < dnaLengthDecision; i++)
        {
            genes[i] = (i < dnaLengthDecision / 2.0) ? d1.GetGene(i) : d2.GetGene(i);
        }

        for (int i = 0; i < geneticProperties.Count; i++)
        {
            geneticProperties[i] = (i < geneticProperties.Count / 2.0) ? d1.geneticProperties[i] : d2.geneticProperties[i];
        }
    }
Пример #2
0
    public void Init()      //set up
    //initialise DNA decisions
    //0 forward
    //1 left
    //2 right
    //initialise DNA properties
    //0 turnrate

    {
        dna = new CDNA(DNALength, 3, new float[, ] {
            { 20, 160 }
        });
        distanceRecord = 0;
        alive          = true;
    }