Ejemplo n.º 1
0
        public void NextDayTest()
        {
            uint size = 25;
            GameOfLife gof = new GameOfLife(size);
            Random rnd = new Random();
            gof.RandomizeWorld(rnd);
            int?[,] world1 = new int?[size, size];
            for (uint x = 0; x < size; x++)
            {
                for (uint y = 0; y < size; y++)
                {
                    world1[x, y] = gof[x, y];
                }
            }

            //Make a day go by
            gof.NextDay();

            int?[,] world2 = new int?[size, size];
            for (uint x = 0; x < size; x++)
            {
                for (uint y = 0; y < size; y++)
                {
                    world2[x, y] = gof[x, y];
                }
            }
            Assert.AreNotEqual(world1, world2);
        }
Ejemplo n.º 2
0
        public void RandomizeWorldTest()
        {
            uint size = 25;
            GameOfLife gof1337 = new GameOfLife(size);
            Random rnd = new Random(1337);
            gof1337.RandomizeWorld(rnd);
            int?[,] world1337 = new int?[size, size];
            for (uint x = 0; x < size; x++)
            {
                for (uint y = 0; y < size; y++)
                {
                    world1337[x, y] = gof1337[x, y];
                }
            }

            GameOfLife gof42 = new GameOfLife(size);
            rnd = new Random(42);
            gof42.RandomizeWorld(rnd);
            int?[,] world42 = new int?[size, size];
            for (uint x = 0; x < size; x++)
            {
                for (uint y = 0; y < size; y++)
                {
                    world42[x, y] = gof42[x, y];
                }
            }
            Assert.AreNotEqual(world1337, world42);
        }