public override void Update(TimeSpan elapsed) { CheckAlive(); if (engine.KeyState.IsKeyDown(Keys.S) && engine.OldKeyState.IsKeyUp(Keys.S)) { DrawSensors = !DrawSensors; } if (engine.KeyState.IsKeyDown(Keys.Escape) && engine.OldKeyState.IsKeyUp(Keys.Escape)) { engine.Exit(); } Console.Clear(); Console.WriteLine($"Generation {GenePool.Generation}"); Console.WriteLine($"Mean Fit: {GenePool.MeanPopulationFitness}"); foreach (IEntity entity in world) { if (entity.GetType() == typeof(Snake)) { Snake snake = (Snake)entity; if (snake.Brain.GetType() != typeof(SnakeBrainGenetic)) { continue; } if (snake.Energy < 0) { Console.ForegroundColor = ConsoleColor.Black; } Console.WriteLine($"Snake Energy: {snake.Energy:00.00} - DNA Fit: {GenePool.Population[((SnakeBrainGenetic)snake.Brain).CurrentDNA].Fitness:00.00} - DNA OldFit: {GenePool.Population[((SnakeBrainGenetic)snake.Brain).CurrentDNA].OldFitness:00.00}"); Console.ResetColor(); } } foreach (IEntity entity in world) { entity.Update(elapsed); //if (entity.GetType() == typeof(Snake)) //{ // Snake snake = (Snake)entity; // ControlSnake(snake); //} } base.Update(elapsed); }