Beispiel #1
0
        static void Main()
        {
            var input = InputGetter.ReadInputAsLines <string>(2020, 2).Result;

            // part1
            var solutionPart1 = Part1Solution(input);

            Console.WriteLine(solutionPart1);

            // part2
            var solutionPart2 = Part2Solution(input);

            Console.WriteLine(solutionPart2);
        }
        static void Main(string[] args)
        {
            string projectFolder = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
            string fileName      = Path.Combine(projectFolder, @"AdventOfCode\Day2\InputDay2.txt");

            string[] lines = InputGetter.GetInputText(fileName);

            string testFile = Path.Combine(projectFolder, @"AdventOfCode\Day2\TestInput.txt");

            string[] testLines = InputGetter.GetInputText(testFile);
            Console.WriteLine(DoMagic1(testLines));
            Console.ReadLine();

            Console.WriteLine(DoMagic1(lines));
            Console.ReadLine();

            Console.WriteLine(DoMagic2(testLines));
            Console.ReadLine();

            Console.WriteLine(DoMagic2(lines));
            Console.ReadLine();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            // InputGetter.ReadInputAsString(2019, 2).Wait();
            var inputLine = InputGetter.ReadInputAsString(2019, 2).Result;
            var input     = inputLine.Split(',').ToList();
            var program   = input.Select(int.Parse).ToList();

            // arrange part 1
            var part1Input = program.Select(ding => ding).ToList();

            part1Input[1] = 12;
            part1Input[2] = 2;

            var part1Solution = Part1Solution(part1Input);

            System.Console.WriteLine(part1Solution);


            // part 2
            for (int i = 0; i < 100; i++)
            {
                for (int j = 0; j < 100; j++)
                {
                    var part2Input = program.Select(ding => ding).ToList();;
                    part2Input[1] = i;
                    part2Input[2] = j;
                    var part2Solution = Part1Solution(part2Input);

                    // System.Console.WriteLine(part2Solution);
                    if (part2Solution == 19690720)
                    {
                        System.Console.WriteLine($"{i} {j}");
                        var part2SolutionOutput = ((100 * i) + j).ToString();
                        System.Console.WriteLine(part2SolutionOutput);
                    }
                }
            }
        }