Example #1
0
        public void Solve_2()
        {
            var input  = File.ReadAllLines("C:\\Code\\aoc2018\\aoc2018\\Data\\input21.txt");
            var result = Day21.Solve(input, firstPart: false);

            _output.WriteLine(result.ToString());
        }
Example #2
0
        public void Solve()
        {
            var input  = DataHelper.GetAllRows(21);
            var solver = new Day21();
            var result = solver.Solve(input);

            Output.WriteLine(result.ToString());
        }
Example #3
0
        public void SampleData()
        {
            string[] sample =
            {
                "swap position 4 with position 0",
                "swap letter d with letter b",
                "reverse positions 0 through 4",
                "rotate left 1 step",
                "move position 1 to position 4",
                "move position 3 to position 0",
                "rotate based on position of letter b",
                "rotate based on position of letter d"
            };
            _day21.Password = "******";
            _day21.Solve(sample);

            Assert.AreEqual("decab", _day21.Password);
        }
Example #4
0
        public void Part1()
        {
            var input  = @"
mxmxvkd kfcds sqjhc nhms (contains dairy, fish)
trh fvjkl sbzzf mxmxvkd (contains dairy)
sqjhc fvjkl (contains soy)
sqjhc mxmxvkd sbzzf (contains fish)".ChopToList();
            var solver = new Day21();
            var result = solver.Solve(input);

            result.ShouldBe(5);
        }