Пример #1
0
        private void btn_Run_Click(object sender, EventArgs e)
        {
            Program = new Main((int)(txt_BirthMin.Value), (int)txt_BirthMax.Value, (int)txt_SurvivalMin.Value, (int)txt_SurvivalMax.Value, (int)txt_Iterations.Value, Program.LivingCells);
            Program.UpdateGridEvent += UpdateGridEvent;
            Program.LivingCells.UpdateCellCount();
            btn_Run.Enabled = false;
            btn_Stop.Enabled = true;

            timer.Enabled = true;
        }
Пример #2
0
        private void Initialize()
        {
            Program = new Main((int)(txt_BirthMin.Value), (int)txt_BirthMax.Value, (int)txt_SurvivalMin.Value, (int)txt_SurvivalMax.Value, (int)txt_Iterations.Value);

            //GUI checks
            chk_DrawGrid.Checked = true;
            chk_IncludeSelf.Checked = false;
            txt_Iterations.Value = 0;
            txt_BirthMin.Value = 3;
            txt_BirthMax.Value = 3;
            txt_SurvivalMin.Value = 2;
            txt_SurvivalMax.Value = 3;
            sldr_Speed.Value = 1;
            btn_Run.Enabled = true;
            btn_Stop.Enabled = false;

            //Grid Setup
            Program.UpdateGridEvent += UpdateGridEvent; //Allows grid to be updated via Main class.
            Bmp = new Bitmap(pix_Grid.Width, pix_Grid.Height);
            pix_Grid.Image = Bmp;
            Gpx = Graphics.FromImage(Bmp);
            Gpx.Clear(BackgroundColor);
            DrawGrid();
        }