示例#1
0
        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]);
                    }
                }
            }
        }
示例#2
0
        public void HandleBeginButtonClick()
        {
            ILifeSimulator simulator = new LifeSimulator(boardModel, boardView, this);

            simulator.CommenceSimulation();
        }
示例#3
0
 public void Reset()
 {
     this.boardModel.Reset();
     this.boardView.Reset();
     LifeSimulator.DisposeSimulator();
 }