Esempio n. 1
0
        public void AnyDeadCellWithExactlyThreeLiveNeighboursBecomesAlive()
        {
            var game = new Game(3);
            game.BringCellToLifeAt(0, 0);
            game.BringCellToLifeAt(0, 1);
            game.BringCellToLifeAt(1, 1);

            game.Tick();
            Assert.True(game.NextLife[1, 0].IsAlive);
        }
Esempio n. 2
0
        public void CellsCanBeBroughtToLife()
        {
            var game = new Game(3);

            game.BringCellToLifeAt(0, 0);
            game.BringCellToLifeAt(0, 1);
            game.BringCellToLifeAt(1, 1);

            Assert.True(game.Life[0, 0].IsAlive);
            Assert.True(game.Life[0, 1].IsAlive);
            Assert.True(game.Life[1, 1].IsAlive);
        }
Esempio n. 3
0
        public void AnyLiveCellWithTwoOrThreeThreeLiveNeighboursLivesOn()
        {
            var game = new Game(3);
            game.BringCellToLifeAt(0, 0);
            game.BringCellToLifeAt(0, 1);
            game.BringCellToLifeAt(1, 1);

            game.Tick();

            Assert.True(game.NextLife[0, 0].IsAlive);
            Assert.True(game.NextLife[0, 1].IsAlive);
            Assert.True(game.NextLife[1, 1].IsAlive);
        }
Esempio n. 4
0
        public void AnyLiveCellWithMoreThanThreeLiveNeighboursDies()
        {
            var game = new Game(3);

            game.BringCellToLifeAt(0, 1);
            game.BringCellToLifeAt(0, 2);
            game.BringCellToLifeAt(1, 0);
            game.BringCellToLifeAt(1, 1);
            game.BringCellToLifeAt(1, 2);

            game.Tick();

            Assert.False(game.NextLife[1, 1].IsAlive);
        }