示例#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);
        }
示例#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);
        }
示例#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));
        }
示例#4
0
        public void Puzzle_17A()
        {
            var initialState = new[]
            {
                "..##.#.#",
                ".#####..",
                "#.....##",
                "##.##.#.",
                "..#...#.",
                ".#..##..",
                ".#...#.#",
                "#..##.##"
            };

            var simulation = new Conway3dCubesSimulation(initialState);

            simulation.Simulate();
            simulation.Simulate();
            simulation.Simulate();
            simulation.Simulate();
            simulation.Simulate();
            simulation.Simulate();
            Assert.Equal(213, simulation.ActiveCubes.Count);
        }