コード例 #1
0
        public void Part2_Answer()
        {
            var day21  = new Day21();
            var input  = ".#./..#/###";
            var actual = day21.Part1(input, PUZZLE_INPUT, 18);

            Assert.Equal(2480380, actual);
        }
コード例 #2
0
        public void Part1()
        {
            var day21    = new Day21();
            var input    = ".#./..#/###";
            var patterns = @"../.# => ##./#../...
.#./..#/### => #..#/..../..../#..#";
            var actual   = day21.Part1(input, patterns, 2);

            Assert.Equal(12, actual);
        }
コード例 #3
0
        public void ShouldFindNumberOfAllergyFreeIngredients()
        {
            var input = new[]
            {
                "mxmxvkd kfcds sqjhc nhms (contains dairy, fish)",
                "trh fvjkl sbzzf mxmxvkd (contains dairy)",
                "sqjhc fvjkl (contains soy)",
                "sqjhc mxmxvkd sbzzf (contains fish)"
            };
            var actual = Day21.Part1(input);

            Assert.Equal(5, actual);
        }
コード例 #4
0
        static void Main(string[] args)
        {
            var sw = new Stopwatch();

            sw.Start();
            var path = "Input/Day21.txt";

            Console.WriteLine($"Part 1: {Day21.Part1(path, 5)}");
            Console.WriteLine($"Part 2: {Day21.Part1(path, 24)}");
            sw.Stop();

            Console.WriteLine($"Time: {sw.ElapsedMilliseconds}");
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
コード例 #5
0
    public void Part1()
    {
        var input = new string[]
        {
            "mxmxvkd kfcds sqjhc nhms (contains dairy, fish)",
            "trh fvjkl sbzzf mxmxvkd (contains dairy)",
            "sqjhc fvjkl (contains soy)",
            "sqjhc mxmxvkd sbzzf (contains fish)",
        };
        var day      = new Day21();
        var expected = 5;
        var actual   = day.Part1(input);

        Assert.Equal(expected, actual);
    }
コード例 #6
0
ファイル: Day21UnitTests.cs プロジェクト: sec/aoc2019
    public void Day21_Part1(long ans)
    {
        var d = new Day21();

        Assert.Equal(ans.ToString(), d.Part1());
    }
コード例 #7
0
ファイル: TestDay21.cs プロジェクト: sujithq/aoc
        public int Part1(string input, int iterarions)
        {
            var target = new Day21();

            return(target.Part1(input, iterarions));
        }