Beispiel #1
0
        private void cbCellList_SelectedIndexChanged(object sender, EventArgs e)
        {
            ICell         _cell = null;
            ComboBox      cb    = (sender as ComboBox);
            ComboBoxEntry entry = (cb.SelectedItem as ComboBoxEntry);

            switch (entry.ID)
            {
            case -1:
                _cell = new AllDeadCell(GRID_SIZE);
                break;

            case 0:
                _cell = new SimpleCustomCell(GRID_SIZE);
                break;

            case 1:
                _cell = new GliderCell(GRID_SIZE);
                break;

            case 2:
                _cell = new SmallExploderCell(GRID_SIZE, 20);
                break;

            case 3:
                _cell = new ExploderCell(GRID_SIZE, 20);
                break;

            case 4:
                _cell = new TenCellRowCell(GRID_SIZE, 20);
                break;

            case 5:
                _cell = new TumblerCell(GRID_SIZE, 20);
                break;

            case 6:
                _cell = new GosperGliderGunCell(GRID_SIZE, 7);
                break;

            case 7:
                _cell = new RandomCell(GRID_SIZE);
                break;

            default:
                break;
            }
            if (_cell != null)
            {
                this.grid1.GridBits = _cell.ToGrid();
                this.generation     = 0;
                this.lblGenNum.Text = generation.ToString();
            }
        }
        public void AllCellsDeadTest_verifyResult()
        {
            bool[,] testGrid = new AllDeadCell(150).ToGrid();

            for (int i = 0; i < testGrid.GetLongLength(0); i++)
            {
                for (int j = 0; j < testGrid.GetLongLength(1); j++)
                {
                    Assert.IsFalse(testGrid[i, j]);
                }
            }
        }