Exemple #1
0
        public void Example_1()
        {
            var initialState = new[]
            {
                ".#.",
                "..#",
                "###"
            };

            var simulation = new Conway3dCubesSimulation(initialState);

            simulation.Simulate();
            var expZ0AtC1 = new[]
            {
                "#.#",
                ".##",
                ".#."
            };

            Assert.Equal(expZ0AtC1, simulation.GetZImage(0));
            Assert.Equal(11, simulation.ActiveCubes.Count);

            simulation.Simulate();
            Assert.Equal(21, simulation.ActiveCubes.Count);

            simulation.Simulate();
            simulation.Simulate();
            simulation.Simulate();
            simulation.Simulate();

            Assert.Equal(112, simulation.ActiveCubes.Count);
        }
Exemple #2
0
        public void GetZImage_should_return_initial_state_given_to_constructor_after_constructing_simulation()
        {
            var initialState = new[]
            {
                ".#.",
                "..#",
                "###"
            };

            var simulation = new Conway3dCubesSimulation(initialState);

            var zImage0 = simulation.GetZImage(0);

            Assert.Equal(initialState, zImage0);
        }
Exemple #3
0
        public void Simplified_test_1()
        {
            var initialState = new[]
            {
                "...",
                "###",
                "..."
            };

            var simulation = new Conway3dCubesSimulation(initialState);

            simulation.Simulate();
            var expZ0AtC1 = new[]
            {
                "#",
                "#",
                "#"
            };

            Assert.Equal(expZ0AtC1, simulation.GetZImage(0));
        }