public void CellCollection_GetEnumerator() { // Arrange var list = new CellCollection(); // Act var enumerator = list.GetEnumerator(); // Assert Assert.IsNotNull(enumerator); }
public bool CanBeActivated(Cell currentCell, CellCollection neighbours) { IEnumerator<Cell> enumerator = neighbours.GetEnumerator(); byte currentCase = 0; int index = neighbours.Count - 1; while (enumerator.MoveNext()) { if (enumerator.Current.State) { currentCase += (byte) Math.Pow(2, index); } index--; } return _rule[currentCase]; }
public bool CanBeActivated(Cell currentCell, CellCollection neighbours) { short count = 0; IEnumerator<Cell> enumerator = neighbours.GetEnumerator(); while (enumerator.MoveNext()) { if (enumerator.Current.State) { count++; } } if (count == 3) { return true; } if (count == 2 && currentCell.State) { return true; } return false; }