Esempio n. 1
0
            public void TwoRightHasOneNeighbor()
            {
                var initial = new[]
                {
                    0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0,
                    0, 0, 1, 1, 0,
                    0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0,
                };

                var universe = new Universe(5, 5);

                universe.SetUniverse(initial);

                var neighbors = universe.CountNeighbors(0, 0);

                Assert.Equal(1, neighbors);
            }
Esempio n. 2
0
            public void TreeByThreeSolidHasEightNeighbors()
            {
                var initial = new[]
                {
                    0, 0, 0, 0, 0,
                    0, 1, 1, 1, 0,
                    0, 1, 1, 1, 0,
                    0, 1, 1, 1, 0,
                    0, 0, 0, 0, 0,
                };

                var universe = new Universe(5, 5);

                universe.SetUniverse(initial);

                var neighbors = universe.CountNeighbors(0, 0);

                Assert.Equal(8, neighbors);
            }
Esempio n. 3
0
            public void SingleCellUniverseHasNoNeighbors()
            {
                var initial = new[]
                {
                    0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0,
                    0, 0, 1, 0, 0,
                    0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0,
                };

                var universe = new Universe(5, 5);

                universe.SetUniverse(initial);

                var neighbors = universe.CountNeighbors(0, 0);

                Assert.Equal(0, neighbors);
            }