void Form_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Space) { stopwatch.Restart(); simulation.Step(); stopwatch.Stop(); Debug.WriteLine(string.Format("Simulation: {0} ms, {1} ticks", stopwatch.ElapsedMilliseconds, stopwatch.ElapsedTicks)); UpdateSimulationGraphics(); } }
public void still_life_works() { int[] points = { 2, 2, 2, 3, 3, 2, 3, 3 }; var simulation = new LimitedSimulation(10, 10); for (int i = 0; i < points.Length - 1; i += 2) { simulation.Grid.SetCell(points[i], points[i + 1], true); } for (int i = 0; i < points.Length - 1; i += 2) { Assert.True(simulation.Grid.GetCell(points[i], points[i + 1])); } simulation.Step(); for (int i = 0; i < points.Length - 1; i += 2) { Assert.True(simulation.Grid.GetCell(points[i], points[i + 1])); } }