コード例 #1
0
    void SetSpecies()
    {
        species.Clear();
        speciesMap.Clear();

        foreach (Genome g in genomes)
        {
            bool match = false;
            foreach (Species s in species)
            {
                if (GenomeUtils.CompatibilityDistance(g, s.mascot, C1, C2, C3) < GenomeUtils.SPECIES_DIST)
                {
                    s.AddMember(g);
                    speciesMap.Add(g, s);
                    match = true;
                    break;
                }
            }
            if (!match)
            {
                Species newSpecies = new Species(g);
                species.Add(newSpecies);
                speciesMap.Add(g, newSpecies);
            }
        }


        Debug.Log("Gen: " + generation + ", Population: " + population + ", Species: " + species.Count);
    }