private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     game              = new GameOfLifeGame(10, 10);
     game.UpdateEvent += UpdateUI;
     game.SetTo(new ToadShape());
     cellColorPicker       = new CellColorPicker(game.settings);
     cellColorPicker.Title = this.Title;
     cellColorPicker.Icon  = this.Icon;
 }
        private void RefreshSizeButton_Click(object sender, RoutedEventArgs e)
        {
            var newSize = 10;

            if (int.TryParse(GridSizeTextBox.Text, out newSize))
            {
                game              = new GameOfLifeGame(newSize, newSize);
                game.UpdateEvent += UpdateUI;
                UpdateUI(null, EventArgs.Empty);
            }
        }
示例#3
0
        public static IGame CreateGridGame(GameName gameName, int rows, int columns)
        {
            IGame game = null;

            switch (gameName)
            {
            case GameName.GameOfLife:
                game = new GameOfLifeGame(rows, columns);
                break;

            default:
                game = new GameOfLifeGame(rows, columns);
                break;
            }

            return(game);
        }
示例#4
0
 public static void Main()
 {
     using (var game = new GameOfLifeGame())
         game.Run();
 }