private static void BeginEvolution(object obj) { LifeSimulator generator = (LifeSimulator)obj; bool[,] nextGeneration = generator.SpawnNextGeneration(generator.boardModel.Board); if (generator.IsEmpty(nextGeneration)) { generator.boardController.Reset(); } else { generator.boardModel.Board = nextGeneration; for (int i = 0; i < generator.boardModel.BoardSize; i++) { for (int j = 0; j < generator.boardModel.BoardSize; j++) { generator.boardView.UpdateCellState(i, j, generator.boardModel.Board[i, j]); } } } }
public void HandleBeginButtonClick() { ILifeSimulator simulator = new LifeSimulator(boardModel, boardView, this); simulator.CommenceSimulation(); }
public void Reset() { this.boardModel.Reset(); this.boardView.Reset(); LifeSimulator.DisposeSimulator(); }