Пример #1
0
        public void solve_for_unknown_answer_part_two()
        {
            var inputs = File.ReadAllLines("./Day02/input_part_one.txt");
            var solver = new DayTwoSolver();

            for (var i = 0; i < 100; i++)
            {
                for (var j = 0; j < 100; j++)
                {
                    var program = inputs[0].Split(",").Select(int.Parse).ToArray();
                    program[1] = i;
                    program[2] = j;
                    var input = program.Select(inputInt => inputInt.ToString())
                                .Aggregate((output, next) => $"{output},{next}");
                    var actual        = solver.PartTwoSolve(input);
                    var resultProgram = actual.Split(",").Select(int.Parse).ToArray();
                    if (resultProgram[0] != 19690720)
                    {
                        continue;
                    }

                    _outputHelper.WriteLine($"{i} : {j}");
                    break;
                }
            }
        }
Пример #2
0
        public void solve_for_expected_answer_part_one(string input, string expected)
        {
            var solver = new DayTwoSolver();

            var actual = solver.PartOneSolve(input);

            actual.Should().Be(expected);
        }
Пример #3
0
        public void solve_for_unknown_answer_part_one()
        {
            var input   = File.ReadAllLines("./Day02/input_part_one.txt")[0];
            var program = input.Split(",").Select(int.Parse).ToArray();

            program[1] = 12;
            program[2] = 2;
            var solver = new DayTwoSolver();

            var actual =
                solver.PartOneSolve(program.Select(i => i.ToString()).Aggregate((output, next) => $"{output},{next}"));

            _outputHelper.WriteLine($"{actual}");
        }
Пример #4
0
        static async Task Main(string[] args)
        {
            var dayOneSolver = new DayOneSolver("../puzzle_input/day_1.txt");
            var solution     = await dayOneSolver.SolveAsync().ConfigureAwait(false);

            Console.WriteLine($"Day 1: {solution}.");

            var dayTwoSolver = new DayTwoSolver("../puzzle_input/day_2.txt");
            var solution2    = await dayTwoSolver.SolveAsync().ConfigureAwait(false);

            Console.WriteLine($"Day 2: {solution2}.");

            var dayThreeSolver = new DayThreeSolver("../puzzle_input/day_3.txt");
            var solution3      = await dayThreeSolver.SolveAsync().ConfigureAwait(false);

            Console.WriteLine($"Day 3: {solution3}.");

            var dayFourSolver = new DayFourSolver("../puzzle_input/day_4.txt");
            var solution4     = await dayFourSolver.SolveAsync().ConfigureAwait(false);

            Console.WriteLine($"Day 4: {solution4}.");

            var dayFiveSolver = new DayFiveSolver("../puzzle_input/day_5.txt");
            var solution5     = await dayFiveSolver.SolveAsync().ConfigureAwait(false);

            Console.WriteLine($"Day 5: {solution5}.");

            var daySixSolver = new DaySixSolver("../puzzle_input/day_6.txt");
            var solution6    = await daySixSolver.SolveAsync().ConfigureAwait(false);

            Console.WriteLine($"Day 6: {solution6}.");

            var daySevenSolver = new DaySevenSolver("../puzzle_input/day_7.txt");
            var solution7      = await daySevenSolver.SolveAsync().ConfigureAwait(false);

            Console.WriteLine($"Day 7: {solution7}.");

            var dayEightSolver = new DayEightSolver("../puzzle_input/day_8.txt");
            var solution8      = await dayEightSolver.SolveAsync().ConfigureAwait(false);

            Console.WriteLine($"Day 8: {solution8}.");
        }
Пример #5
0
        static void Main(string[] args)
        {
            var solver = new DayOneSolver(new FileReader());

            solver.SolvePartOne();

            solver.SolvePartTwo();

            var solverTwo = new DayTwoSolver(new FileReader());

            solverTwo.SolvePartOne();

            solverTwo.SolvePartTwo();

            var solverThree = new DayThreeSolver(new FileReader());

            solverThree.SolvePartOne();
            solverThree.SolvePartTwo();

            var solverFour = new DayFourSolver();

            solverFour.SolvePartOne();
            solverFour.SolvePartTwo();
        }