Пример #1
0
    public void InsertGenomeIntoSpecies(Genome g, List <Species> inserIntoSpecies)
    {
        // bool speciesFound = false;

        for (int i = 0; i < inserIntoSpecies.Count; i++)
        {
            if (!inserIntoSpecies[i].CheckExtinct())
            {
                List <Genome> genomesInSpecies = inserIntoSpecies[i].GetGenomes();
                Genome        g2 = genomesInSpecies[Random.Range(0, genomesInSpecies.Count)];
                //Genome g2 = genomesInSpecies[0];
                if (g.CheckMatchingSpecies(g2))
                {
                    //speciesFound = true;
                    //genomesInSpecies.Add(g);
                    inserIntoSpecies[i].AddGenome(g);

                    return;
                }
            }
        }
        Species newSpecies = new Species(g, gt.NewSpeciesId(), false);

        inserIntoSpecies.Add(newSpecies);
    }
Пример #2
0
    public void InsertGenomeIntoSpecies(Genome g, List <Species> inserIntoSpecies, List <Species> checkSpecies)
    {
        // bool speciesFound = false;

        for (int i = 0; i < checkSpecies.Count; i++)
        {
            List <Genome> genomesInSpecies = checkSpecies[i].GetGenomes();
            if (!checkSpecies[i].CheckExtinct())
            {
                Genome g2 = genomesInSpecies[0];
                if (g.CheckMatchingSpecies(g2))
                {
                    //speciesFound = true;
                    //genomesInSpecies.Add(g);
                    inserIntoSpecies[i].GetGenomes().Add(g);
                    return;
                }
            }
        }
        Debug.Log("fail" + g);
    }