static void Main(string[] _) { var sizeOfSurface = 20; var rnd = new Random(876); var coordinates = BuildUniqueCoordinates(20, rnd, sizeOfSurface); var surfaceEvents = new List <Event>() { new CreateBoardAccepted(sizeOfSurface, sizeOfSurface, coordinates.Take(10).Select(c => new Herbivore(c.X, c.Y, "asd")), coordinates.Skip(10).Select(c => new Carnivore(c.X, c.Y, "isaac", 10)), "none", "none", DateTime.Now) }; var surface = new Surface(surfaceEvents, rnd); int numberOfHerbivores = 10; for (int i = 0; i < numberOfHerbivores; i++) { surface = AddHerbivore(surfaceEvents, rnd, sizeOfSurface, i); } int numberOfCarnivores = 10; for (int i = 0; i < numberOfCarnivores; i++) { surface = AddCarnivore(surfaceEvents, rnd, sizeOfSurface, i); } var toScreen = new SurfaceToConsoleAdapter(); toScreen.Output(surface); StartSimulation(surfaceEvents, toScreen, rnd); }
private static void StartSimulation(List <Event> surfaceEvents, SurfaceToConsoleAdapter toScreen, Random rnd) { int currentMove = 0; while (true) { System.Console.Clear(); System.Console.WriteLine($"Current Move is: {currentMove}"); var surface = new Surface(surfaceEvents, rnd); toScreen.Output(surface); Task.Delay(TimeSpan.FromMilliseconds(500)).GetAwaiter().GetResult(); currentMove++; } }