Beispiel #1
0
    public void ArtificialCombineHighestValueZeroVariationTest()
    {
        const float V = 100;
        const int   W = 0;
        const int   X = 15;
        const int   Y = 15;
        bool        Z = true;

        Godot.Collections.Array initialValues = new Godot.Collections.Array();
        Genome gen = new Genome();

        for (int i = 0; i < X; i++)
        {
            initialValues.Add(V);
        }
        gen.ArtificialCombine(initialValues, W);
        if (CheckChromosome(gen.getMaternal()) && CheckChromosome(gen.getPaternal()))
        {
            Z = true;
        }
        else
        {
            Z = false;
        }
        Assert.IsEqual(X, gen.getMaternal().Count, "Then it Passes");
        Assert.IsEqual(Y, gen.getPaternal().Count, "Then it Passes");
        Assert.IsTrue(Z, "Then it Passes");
    }
Beispiel #2
0
    public void MeiosisTest()
    {
        bool flag = true;

        Godot.Collections.Array initialValues = new Godot.Collections.Array();
        Genome gen = new Genome();

        for (int i = 0; i < 15; i++)
        {
            initialValues.Add(50.0f);
        }
        gen.ArtificialCombine(initialValues, 20);
        Godot.Collections.Array newChromosome = gen.Meiosis();
        flag = CheckChromosome(newChromosome);
        Assert.IsEqual(15, newChromosome.Count, "Then it Passes");
        Assert.IsTrue(flag, "Then it Passes");
    }
Beispiel #3
0
    public void GetTraitMaxIndexTest()
    {
        const int   X = 14;
        const float Y = 50;

        Godot.Collections.Array initialValues = new Godot.Collections.Array();
        Genome gen = new Genome();

        for (int i = 0; i < 15; i++)
        {
            if (i != X)
            {
                initialValues.Add(0.0f);
            }
            else
            {
                initialValues.Add(Y);
            }
        }
        gen.ArtificialCombine(initialValues, 0);

        Assert.IsEqual(Y, gen.GetTrait((Genome.GeneticTrait)X), "Then it Passes");
    }