/// <summary> /// Simulates one step in the Game of Life. /// </summary> /// <param name="oldGameField">The IGameField from the last simulation step.</param> /// <param name="newGameField">The IGameField to fill with this simulation step.</param> public void SimulateStep( IGameField oldGameField, IGameField newGameField ) { Debug.Assert( oldGameField.Width == newGameField.Width ); Debug.Assert( oldGameField.Height == newGameField.Height ); int width = oldGameField.Width; int height = oldGameField.Height; for( int x = 0; x < width; ++x ) { for( int y = 0; y < height; ++y ) { newGameField.SetCellState( x, y, this.SimulateCell( x, y, oldGameField ) ); } } }