Ejemplo n.º 1
0
        /// <summary>
        /// Prints current Gene values and resets the environment with new genes selected
        /// </summary>
        public void Reset()
        {
            AddLine(AgentType.Pacman, string.Format("\nGeneration: {3}/{0} Actions: {2} Fitness: {1}", _pacmanGeneIndex, GetFitnessValue(Pacman), Pacman.GetActionCount(), Pacman.Evolutions), true);
            AddLine(AgentType.Ghost, string.Format("\nGeneration: {3}/{0} Actions: {2} Fitness: {1}", _ghostGeneIndex, GetFitnessValue(Ghost), Ghost.GetActionCount(), Ghost.Evolutions), true);

            Maze.MoveAgent(Pacman, Pacman.Reset());
            Maze.MoveAgent(Ghost, Ghost.Reset());

            Maze.ReplaceFruits(_settings.RandomFruitPositions);

            SetNextGenes();

            _fruitsCollected = 0;
            SetFruitsCollected(0);

            SetActionsText(AgentType.Ghost, 0);
            SetActionsText(AgentType.Pacman, 0);

            _isPlaying = true;
        }