public Form1()
 {
     InitializeComponent();
     timer       = new Timer();
     rnd         = new Random();
     timer.Tick += new EventHandler(timer_Tick);
     GameOfLifeBoxInit();
     lifeGrid  = new LifeGrid(new bool[20, 20]);
     isRunning = false;
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var grid = new LifeGrid(25, 65);

            grid.Randomize();

            ShowGrid(grid.CurrentState);

            while (Console.ReadLine() != "q")
            {
                grid.UpdateState();
                ShowGrid(grid.CurrentState);
            }
        }
        private void resetButton_Click(object sender, EventArgs e)
        {
            if (gridScaleBox.Text == "" || gridSizeBox.Text == "")
            {
                MessageBox.Show("ERROR: Enter size and scale into text boxes");
                return;
            }

            if (gridScaleBox.Text != "")
            {
                gridScale = Convert.ToInt32(gridScaleBox.Text);
            }
            lifeGrid = new LifeGrid(new bool[Convert.ToInt32(gridSizeBox.Text), Convert.ToInt32(gridSizeBox.Text)]);
            DrawGrid(lifeGrid.grid);
        }