コード例 #1
0
        public void Day20_Example1_Part2_Ok()
        {
            var lines = DailyDataUtilities.ReadLinesFromFile("Day20Example1Data.txt");

            Assert.Equal(107, lines.Length);

            var sut = new JurassicJigsaw();

            sut.ReadTiles(new List <string>(lines));
            Assert.Equal(9, sut.Tiles.Count);

            do
            {
                sut.DoChanges();
                sut.ProcessEdges();
                if (sut.FindActions())
                {
                    continue;
                }
                sut.ProcessReverseMatches();
                sut.FindActions();
            } while (sut.Changes.Count > 0);
            sut.DumpEdges();
            long total = sut.FindCornerTotal();

            Assert.Equal(20899048083289, total);

            sut.MatchTiles();
            Assert.NotNull(sut.StartCorner);

            sut.DumpTileIds();
            Assert.NotNull(sut);
        }
コード例 #2
0
        public void Day20_JurassicJigsaw_Part2_Ok()
        {
            var lines = DailyDataUtilities.ReadLinesFromFile("Day20Data.txt");

            Assert.Equal(1727, lines.Length);

            var sut = new JurassicJigsaw();

            sut.ReadTiles(new List <string>(lines));
            Assert.Equal(144, sut.Tiles.Count);

            do
            {
                sut.DoChanges();
                sut.ProcessEdges();
                if (sut.FindActions())
                {
                    continue;
                }
                sut.ProcessReverseMatches();
                sut.FindActions();
            } while (sut.Changes.Count > 0);
            sut.DumpEdges();

            long total = sut.FindCornerTotal();

            Assert.Equal(15003787688423, total);
        }
コード例 #3
0
        public void Day20_Example1_Ok()
        {
            var lines = DailyDataUtilities.ReadLinesFromFile("Day20Example1Data.txt");

            Assert.Equal(107, lines.Length);

            var sut = new JurassicJigsaw();

            sut.ReadTiles(new List <string>(lines));
            Assert.Equal(9, sut.Tiles.Count);

            sut.ProcessEdges();
            Assert.Equal(34, sut.Edges.Count);

            sut.ProcessMatches();
            Assert.Equal(34, sut.Edges.Count);

            long total = sut.FindCornerTotal();

            Assert.Equal(20899048083289, total);
        }
コード例 #4
0
        public void Day20_JurassicJigsaw_Part1_Ok()
        {
            var lines = DailyDataUtilities.ReadLinesFromFile("Day20Data.txt");

            Assert.Equal(1727, lines.Length);

            var sut = new JurassicJigsaw();

            sut.ReadTiles(new List <string>(lines));
            Assert.Equal(144, sut.Tiles.Count);

            sut.ProcessEdges();
            Assert.Equal(453, sut.Edges.Count);

            sut.ProcessMatches();
            Assert.Equal(453, sut.Edges.Count);

            sut.DumpDoubleFalseEdges();
            long total = sut.FindCornerTotal();

            Assert.Equal(15003787688423, total);
        }