Ejemplo n.º 1
0
        public void Solve2()
        {
            var input  = InputDataHelper.Get(10).Replace("\n", "\r\n");
            var result = Day10.Solve2(input, 17, 22, 200);

            _testOutputHelper.WriteLine(result.ToString());
        }
Ejemplo n.º 2
0
        public void Solve1()
        {
            var input  = InputDataHelper.Get(8).Trim();
            var result = new Day08().Solve(input, 25, 6);

            _testOutputHelper.WriteLine(result.ToString());
        }
Ejemplo n.º 3
0
        public void Solve2()
        {
            var input  = InputDataHelper.Get(8).Trim();
            var result = new Day08().Solve2(input, 25, 6);

            _testOutputHelper.WriteLine(result.Replace('0', ' '));
        }
Ejemplo n.º 4
0
        public void Solve2()
        {
            var input  = InputDataHelper.Get(7);
            var output = new Day07().Solve2(input);

            _testOutputHelper.WriteLine(output.ToString());
        }
Ejemplo n.º 5
0
        public void Solve2()
        {
            var input  = InputDataHelper.Get(15);
            var solver = new Day15();
            var result = solver.Solve2(input);

            _testOutputHelper.WriteLine(result.ToString());
        }
Ejemplo n.º 6
0
        public void SolvePart2()
        {
            var lines  = InputDataHelper.Get(5);
            var solver = new Day05();
            var result = solver.Solve(lines, 5);

            _testOutputHelper.WriteLine(string.Join(",", result));
        }
Ejemplo n.º 7
0
        public void Solve2()
        {
            var data   = InputDataHelper.GetLines(6);
            var solver = new Day06();
            var result = solver.Solve2(data);

            _testOutputHelper.WriteLine(result.ToString());
        }
Ejemplo n.º 8
0
        public void Solve2()
        {
            var input  = InputDataHelper.Get(13);
            var solver = new Day13();
            var score  = solver.Solve2(input);

            _testOutputHelper.WriteLine(score.ToString());
        }
Ejemplo n.º 9
0
        public void Solve()
        {
            var input  = InputDataHelper.Get(14);
            var solver = new Day14();
            var result = solver.Solve(input, 1);

            _outputHelper.WriteLine(result.ToString());
        }
Ejemplo n.º 10
0
        public void Part1Solution()
        {
            var solver = new Day01();
            var data   = InputDataHelper.GetLines(1);
            var result = data.Sum(d => solver.Solve(int.Parse(d)));

            _testOutputHelper.WriteLine(result.ToString());
        }
Ejemplo n.º 11
0
        public void Solve()
        {
            var input  = InputDataHelper.Get(16);
            var solver = new Day16();
            var result = solver.Solve(input, 100);

            _testOutputHelper.WriteLine(result);
        }
Ejemplo n.º 12
0
        public void Solve()
        {
            var input  = InputDataHelper.Get(12).Trim();
            var solver = new Day12();
            var result = solver.Solve(input, 1000);

            _testOutputHelper.WriteLine(result.ToString());
        }
Ejemplo n.º 13
0
        public void Part2Solution()
        {
            var lines  = InputDataHelper.GetLines(3);
            var solver = new Day03();
            var result = solver.Solve2(lines[0], lines[1]);

            _testOutputHelper.WriteLine(result.ToString());
        }
Ejemplo n.º 14
0
        public void Solve2()
        {
            var instructions = InputDataHelper.Get(9).Trim();
            var computer     = new IntCodeComputer(instructions);
            var output       = computer.AddInput(2).Run().Output();

            _testOutputHelper.WriteLine(string.Join(",", output));
        }
Ejemplo n.º 15
0
        public void Solve2()
        {
            var input  = InputDataHelper.Get(12).Trim();
            var solver = new Day12();
            var result = solver.Solve2(input, _testOutputHelper);

            _testOutputHelper.WriteLine(result.ToString());

            // too low: 5607666906324
            // trying: 307043147758488
            // too high: 1465099063465813344
        }
Ejemplo n.º 16
0
        public void Solve()
        {
            var input  = InputDataHelper.Get(13);
            var solver = new Day13();
            var tiles  = solver.Solve(input);

            _testOutputHelper.WriteLine(tiles.ToString());

            var result = tiles.BlocksRemaining;

            _testOutputHelper.WriteLine(result.ToString());
        }
Ejemplo n.º 17
0
        public void Part2()
        {
            var          code = InputDataHelper.Get(17);
            const string a    = "R,8,L,12,R,8";
            const string b    = "R,12,L,8,R,10";
            const string c    = "R,8,L,8,L,8,R,8,R,10";
            const string p    = "A,B,B,A,C,A,A,C,B,C";

            var solver = new Day17();
            var result = solver.Solve(code, a, b, c, p);

            _testOutputHelper.WriteLine(result);
        }
Ejemplo n.º 18
0
        public void Part1Solution()
        {
            var data   = InputDataHelper.Get(2);
            var solver = new Day02();

            var result = solver.Solve(data, input =>
            {
                input[1] = 12;
                input[2] = 2;
            });

            _testOutputHelper.WriteLine(result.ToString());
        }
Ejemplo n.º 19
0
        public void Solve()
        {
            var code     = InputDataHelper.Get(17);
            var computer = new IntCodeComputer(code);

            computer.Run();

            var output = computer.Output();
            var input  = new string(output.Select(l => (char)l).ToArray());

            _testOutputHelper.WriteLine(input);

            var solver = new Day17();
            var result = solver.Calibrate(input);

            _testOutputHelper.WriteLine(result.ToString());
        }
Ejemplo n.º 20
0
        public void Part2Solution()
        {
            var data = InputDataHelper.Get(2);

            for (var i = 0; i < 100; i++)
            {
                for (var j = 0; j < 100; j++)
                {
                    var noun   = i;
                    var verb   = j;
                    var result = new Day02().Solve(data, input =>
                    {
                        input[1] = noun;
                        input[2] = verb;
                    });

                    if (result == 19690720)
                    {
                        _testOutputHelper.WriteLine($"noun: {i}, verb: {j}, final result: {100 * noun + verb}");
                    }
                }
            }
        }
Ejemplo n.º 21
0
 public void Solve2()
 {
     var input  = InputDataHelper.Get(16);
     var solver = new Day16();
 }