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 GosperGliderGunCellTest_correctSizeReturned() { //Odd (unusual) size bool[,] _result = new GosperGliderGunCell(47).ToGrid(); Assert.AreEqual(_result.GetLongLength(0), 47); Assert.AreEqual(_result.GetLongLength(1), 47); _result = new GosperGliderGunCell(50).ToGrid(); Assert.AreEqual(_result.GetLongLength(0), 50); Assert.AreEqual(_result.GetLongLength(1), 50); }
public void GosperGliderGunCellTes_correctShape() { //Checking the full shape is not pratical nor maintainable. We'll spot check... bool[,] testGrid = new GosperGliderGunCell(41, 0).ToGrid(); Assert.IsTrue(testGrid[2, 0]); Assert.IsTrue(testGrid[0, 34]); Assert.IsTrue(testGrid[12, 26]); Assert.IsTrue(testGrid[1, 35]); Assert.IsTrue(testGrid[2, 23]); }