示例#1
0
        //возвращает случайную популящию;
        public static List <Genom> GetChilds(Genom parent, int childsCount)
        {
            List <Genom> childs = new List <Genom>();

            for (int i = 0; i < childsCount; i++)
            {
                Genom g = new Genom(parent); //copy

                g.RandomizeAll();

                childs.Add(g);
            }

            return(childs);
        }
示例#2
0
        private void Start()
        {
            //sensors = InitSensors();
            //Debug.Log("ApplyGenom");

            if (mode == Mode.Train || mode == Mode.LoadAndTrain)
            {
                if (!genomInistalized)
                {
                    Debug.LogWarning("Genom is not inistalized.\n Maybe you forgot add GeneticGame.cs on scene?");
                    Genom newgenom = InitGenom();
                    newgenom.RandomizeAll();
                    SetGenom(newgenom);
                }
            }
            else if (mode == Mode.LoadAndTest)
            {
                SetGenom(Genom.LoadFromFile(GetSavePath()));
            }

            //Debug.Log(genom);

            ApplyGenom(genom);
        }