Ejemplo n.º 1
0
        /// <summary>
        /// Sets next genes from current population, otherwise evolves the agents
        /// </summary>
        public void SetNextGenes()
        {
            _pacmanGeneIndex++;
            _ghostGeneIndex++;

            if (_pacmanGeneIndex >= Pacman.GeneticAlgorithm.Population.Count)
            {
                EvolveAgent(Pacman);
                _pacmanGeneIndex = 0;

                SetGenerationText(Pacman.Evolutions);
            }

            if (_ghostGeneIndex >= Ghost.GeneticAlgorithm.Population.Count)
            {
                EvolveAgent(Ghost);
                _ghostGeneIndex = 0;
            }

            Pacman.Moves = 0;
            Ghost.Moves  = 0;
            var pacG   = Pacman.SetGene(_pacmanGeneIndex);
            var ghostG = Ghost.SetGene(_ghostGeneIndex);

            //AddLine(AgentType.Pacman, pacG);
            //AddLine(AgentType.Ghost, ghostG);
        }