Example #1
0
 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();
     }
 }
Example #2
0
		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;
			}
		}
Example #3
0
        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)
 {
 }
 public void Update(IReadonlyField field)
 {
 }