public void BasicBlinkerOscilatesTwoTimes()
 {
     List<Cell> alive = new List<Cell>();
     alive.Add(new Cell(0, 0));
     alive.Add(new Cell(1, 0));
     alive.Add(new Cell(2, 0));
     GameBoard board = new GameBoard(alive);
     List<Cell> aliveNew = new List<Cell>();
     aliveNew.Add(new Cell(1, 0));
     aliveNew.Add(new Cell(0, 0));
     aliveNew.Add(new Cell(2, 0));
     board.Tick();
     board.Tick();
     CollectionAssert.AreEqual(aliveNew, board.AliveCells);
 }
        public void TestEmptyBoard()
        {
            var g = new GameBoard(new int[][]
            {
                new[] { 0, 0, 0 },
                new[] { 0, 0, 0 },
                new[] { 0, 0, 0 },
            });

            g.Tick();

            AssertEqualBoard(g, new int[][]
            {
                new[] { 0, 0, 0 },
                new[] { 0, 0, 0 },
                new[] { 0, 0, 0 },
            });
        }
        public void TestFourCornersReturnEmpty()
        {
            var g = new GameBoard(new int[][]
            {
                new [] { 1, 0, 1 },
                new [] { 0, 0, 0 },
                new [] { 1, 0, 1 },
            });

            g.Tick();

            AssertEqualBoard(g, new int[][]
            {
                new [] { 0, 0, 0 },
                new [] { 0, 0, 0 },
                new [] { 0, 0, 0 },
            });
        }
        public void TestBoardGrowsLeft()
        {
            var g = new GameBoard(new int[][]
            {
                new [] { 1, 0, 0 },
                new [] { 1, 0, 0 },
                new [] { 1, 0, 0 },
            });

            g.Tick();

            AssertEqualBoard(g, new int[][]
            {
                new [] { 0, 0, 0, 0 },
                new [] { 1, 1, 0, 0 },
                new [] { 0, 0, 0, 0 },
            });
        }
 public void SqaureStaysASquare()
 {
     List<Cell> alive = new List<Cell>();
     alive.Add(new Cell(0, 0));
     alive.Add(new Cell(0, 1));
     alive.Add(new Cell(1, 0));
     alive.Add(new Cell(1, 1));
     GameBoard board = new GameBoard(alive);
     board.Tick();
     Assert.AreEqual(4, board.AliveCells.Count);
 }
        public void TestFourNeigborsKillsYou()
        {
            var g = new GameBoard(new int[][]
            {
                new [] { 0, 0, 0, 0 },
                new [] { 0, 1, 1, 0 },
                new [] { 0, 1, 1, 0 },
                new [] { 0, 1, 0, 0 },
            });

            g.Tick();

            AssertEqualBoard(g, new int[][]
            {
                new [] { 0, 0, 0, 0 },
                new [] { 0, 1, 1, 0 },
                new [] { 1, 0, 0, 0 },
                new [] { 0, 1, 1, 0 },
            });
        }
        public void TestUpperEdgeReturnsEmpty()
        {
            var g = new GameBoard(new int[][]
            {
                new [] { 0, 1, 0 },
                new [] { 0, 0, 0 },
                new [] { 0, 0, 0 },
            });

            g.Tick();

            AssertEqualBoard(g, new int[][]
            {
                new [] { 0, 0, 0 },
                new [] { 0, 0, 0 },
                new [] { 0, 0, 0 },
            });
        }
        public void TestThreeNeighborsComesAlive()
        {
            var g = new GameBoard(new int[][]
            {
                new [] { 0, 1, 0 },
                new [] { 0, 1, 0 },
                new [] { 0, 1, 0 },
            });

            g.Tick();

            AssertEqualBoard(g, new int[][]
            {
                new [] { 0, 0, 0 },
                new [] { 1, 1, 1 },
                new [] { 0, 0, 0 },
            });
        }
        public void TestOneNeighborDies()
        {
            var g = new GameBoard(new int[][]
            {
                new [] { 0, 0, 0,},
                new [] { 0, 0, 1,},
                new [] { 0, 0, 1,},
            });

            g.Tick();

            AssertEqualBoard(g, new int[][]
            {
                new [] { 0, 0, 0,},
                new [] { 0, 0, 0,},
                new [] { 0, 0, 0,},
            });
        }
예제 #10
0
        public void TestOneAliveDies()
        {
            var g = new GameBoard(new int[][]
            {
                new [] { 0, 0, 0 },
                new [] { 0, 1, 0 },
                new [] { 0, 0, 0 },
            });

            g.Tick();

            AssertEqualBoard(g, new int[][]
            {
                new [] { 0, 0, 0 },
                new [] { 0, 0, 0 },
                new [] { 0, 0, 0 },
            });
        }