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

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

            Assert.Equal(12, actual);
        }
        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);
        }
Example #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();
        }
Example #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);
    }
Example #6
0
    public void Day21_Part1(long ans)
    {
        var d = new Day21();

        Assert.Equal(ans.ToString(), d.Part1());
    }
Example #7
0
        public int Part1(string input, int iterarions)
        {
            var target = new Day21();

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