public void UpdateAll(IReadonlyField field) { Console.SetCursorPosition(0, 0); for (int y = 0; y < field.Height; y++) { for (int x = 0; x < field.Width; x++) { var symbol = field.IsAlive(x, y) ? '#' : ' '; Console.Write(symbol); } Console.WriteLine(); } }
public void Update(IReadonlyField field) { var oldColor = Console.BackgroundColor; try { Console.SetCursorPosition(0, 0); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { var age = field.GetAge(x, y); Console.BackgroundColor = colors[Math.Min(age, colors.Length - 1)]; Console.Write(' '); } Console.WriteLine(); } } finally { Console.BackgroundColor = oldColor; } }
public void Update(IReadonlyField field) { }