private void GameNew() { SetUiForGameState(GameStates.Idle); PregameCells = _grid.CreateEmptyGeneration(); _gaea?.Clear(); _gaea = null; }
private void RaiseGaeaOnDemand() { if (_gaea == null) { var generationZero = PregameCells.HasLiveCells ? PregameCells : _grid.CreateRandomGeneration(); _gaea = new Gaea(_grid, new Rules(), UpdateGameVisualization, generationZero); } _gaea.DelayMilliseconds = SpeedSlider.Value; }
public void RunThrowsOnMissizedCells() { var gen = new Generation { { new RowCol(0, 0), false } }; var gaea = new Gaea(new Grid(2, 2), new Rules(), (i, c) => { }, gen); Assert.Throws <ArgumentException>(() => gaea.Run()); }
public void ThrowsOnInvalidDelay() { var tooSmall = Gaea.MinDelayMilliseconds - 1; var tooBig = Gaea.MaxDelayMilliseconds + 1; var gaea = new Gaea(new Grid(), new Rules()); Assert.Throws <ArgumentOutOfRangeException>(() => gaea.DelayMilliseconds = tooSmall); Assert.Throws <ArgumentOutOfRangeException>(() => gaea.DelayMilliseconds = tooBig); }
public void DelayMillisecondsPropertyDefaultsAndSets() { var gaea = new Gaea(new Grid(), new Rules()); Assert.AreEqual(Gaea.DefaultDelayMilliseconds, gaea.DelayMilliseconds); gaea.DelayMilliseconds = 100; Assert.AreEqual(100, gaea.DelayMilliseconds); }
public void CanBeCreated() { var grid = new Grid(); var rules = new Rules(); var gaea = new Gaea(grid, rules); Assert.NotNull(gaea); }
public void RunThrowsOnNullCells() { var gaea = new Gaea(new Grid(), new Rules()); Assert.Throws <ArgumentNullException>(() => gaea.Run()); }