コード例 #1
0
        public void CyclicSetUpShouldBeTheSameAfter3Periods()
        {
            var input = "...............\n" +
                        "...***...***...\n" +
                        "...............\n" +
                        ".*....*.*....*.\n" +
                        ".*....*.*....*.\n" +
                        ".*....*.*....*.\n" +
                        "...***...***...\n" +
                        "...............\n" +
                        "...***...***...\n" +
                        ".*....*.*....*.\n" +
                        ".*....*.*....*.\n" +
                        ".*....*.*....*.\n" +
                        "...............\n" +
                        "...***...***...\n" +
                        "...............";

            var gol = new GameOfLife(input);

            gol.NextStep();
            gol.NextStep();
            gol.NextStep();

            Assert.AreEqual(input, gol.CurrentState);
        }
コード例 #2
0
        public void BlinkerExample()
        {
            var input = "...\n" +
                        "***\n" +
                        "...";

            var gol = new GameOfLife(input);

            gol.NextStep();

            var expectedOutput = ".*.\n" +
                                 ".*.\n" +
                                 ".*.";

            Assert.AreEqual(expectedOutput, gol.CurrentState);
        }
コード例 #3
0
        public void BeaconExample()
        {
            var input = "**..\n" +
                        "**..\n" +
                        "..**\n" +
                        "..**";

            var gol = new GameOfLife(input);

            gol.NextStep();

            var expectedOutput = "**..\n" +
                                 "*...\n" +
                                 "...*\n" +
                                 "..**";

            Assert.AreEqual(expectedOutput, gol.CurrentState);
        }
コード例 #4
0
        public void StaticLoafExample()
        {
            var input = ".**.\n" +
                        "*..*\n" +
                        ".*.*\n" +
                        "..*.";

            var gol = new GameOfLife(input);

            gol.NextStep();

            var expectedOutput = ".**.\n" +
                                 "*..*\n" +
                                 ".*.*\n" +
                                 "..*.";

            Assert.AreEqual(expectedOutput, gol.CurrentState);
        }