private static void OutputAverageOfAllSimulations(List <SimulationResult> simResults) { Console.Write("\n\nAbout to display average result of all simulations. Press any key to continue:"); Console.ReadKey(); Console.Clear(); var byDayDoc = new Alba.CsConsoleFormat.Document( new Grid() { Color = ConsoleColor.Gray, Columns = { GridLength.Auto, GridLength.Auto, GridLength.Auto, GridLength.Auto }, Children = { new Cell("Day #") { Stroke = _hdrThickness, Align = Align.Center }, new Cell("Infected") { Stroke = _hdrThickness, Align = Align.Center }, new Cell("Contagious") { Stroke = _hdrThickness, Align = Align.Center }, new Cell("Died") { Stroke = _hdrThickness, Align = Align.Center }, simResults.Select((r, i) => new[] { new Cell(i + 1) { Align = Align.Center, Color = ConsoleColor.DarkRed }, new Cell($"{r.Infected / _arguments.Simulations:n0}") { Align = Align.Center, Color = ConsoleColor.Yellow }, new Cell($"{r.Contagious / _arguments.Simulations:n0}") { Align = Align.Center, Color = ConsoleColor.DarkCyan }, new Cell($"{r.Died / _arguments.Simulations:n0}") { Align = Align.Center, Color = ConsoleColor.Red } }) } }); ConsoleRenderer.RenderDocument(byDayDoc); }
private static void OutputSimulationResult(int simNum, SimulationResult lastDay) { Console.SetCursorPosition(0, 0); var simDoc = new Alba.CsConsoleFormat.Document( new Grid() { Color = ConsoleColor.Gray, Columns = { GridLength.Auto, GridLength.Auto, GridLength.Auto, GridLength.Auto }, Children = { new Cell("Run #") { Stroke = _hdrThickness, Align = Align.Center }, new Cell("Infected") { Stroke = _hdrThickness, Align = Align.Center }, new Cell("Contagious") { Stroke = _hdrThickness, Align = Align.Center }, new Cell("Died") { Stroke = _hdrThickness, Align = Align.Center }, new Cell(simNum + 1) { Align = Align.Center, Color = ConsoleColor.DarkRed }, new Cell($"{lastDay.Infected / _arguments.Simulations:n0}") { Align = Align.Center, Color = ConsoleColor.Yellow }, new Cell($"{lastDay.Contagious / _arguments.Simulations:n0}") { Align = Align.Center, Color = ConsoleColor.DarkCyan }, new Cell($"{lastDay.Died / _arguments.Simulations}") { Align = Align.Center, Color = ConsoleColor.Red } } }); ConsoleRenderer.RenderDocument(simDoc); }
private static void OutputAssumptions() { Console.SetCursorPosition(0, 0); var doc = new Alba.CsConsoleFormat.Document( new Span("Viral Propagation Simulation") { Color = Yellow }, new Grid() { Color = ConsoleColor.Gray, Columns = { GridLength.Auto, GridLength.Auto }, Children = { new Cell("Iterations to run") { Stroke = _hdrThickness, Align = Align.Left }, new Cell($"{_arguments.Simulations:n0}") { Stroke = _hdrThickness, Align = Align.Right }, new Cell("Population") { Stroke = _hdrThickness, Align = Align.Left }, new Cell($"{_arguments.Population:n0}") { Stroke = _hdrThickness, Align = Align.Right }, new Cell("Neighborhood size") { Stroke = _hdrThickness, Align = Align.Left }, new Cell($"{_arguments.Neighbors:n0}") { Stroke = _hdrThickness, Align = Align.Right }, new Cell("Infectious period, days") { Stroke = _hdrThickness, Align = Align.Left }, new Cell($"{_arguments.Contagious:n0}") { Stroke = _hdrThickness, Align = Align.Right }, new Cell("Contacts per day") { Stroke = _hdrThickness, Align = Align.Left }, new Cell($"{_arguments.Interactions:n0}") { Stroke = _hdrThickness, Align = Align.Right }, new Cell("Chance of passing on infection per contact") { Stroke = _hdrThickness, Align = Align.Left }, new Cell($"{100 * _arguments.Transmission:n1}%") { Stroke = _hdrThickness, Align = Align.Right }, new Cell("Mortality rate") { Stroke = _hdrThickness, Align = Align.Left }, new Cell($"{100 * _arguments.Mortality:n1}%") { Stroke = _hdrThickness, Align = Align.Right }, } }); ConsoleRenderer.RenderDocument(doc); }