Пример #1
0
        static void day9()
        {
            long[]         inputs  = getInputs("./day9/input.txt")[0].Split(',').Select(x => long.Parse(x)).ToArray();
            IntcodeMachine machine = new IntcodeMachine(inputs);

            machine.input.Enqueue(1);
            machine.runToEnd();
            machine.printOutput(); // Part 1. Answer: 2171728567

            machine = new IntcodeMachine(inputs);
            machine.input.Enqueue(2);
            machine.runToEnd();
            machine.printOutput(); // Part2. Answer: 49815
        }
Пример #2
0
        static void day5()
        {
            long[]         inputs  = getInputs("./day5/input.txt")[0].Split(',').Select(x => long.Parse(x)).ToArray();
            IntcodeMachine machine = new IntcodeMachine(inputs);

            machine.input.Enqueue(1);
            machine.runToEnd();
            machine.printOutput(); // Part 1. Answer: 7988899

            machine = new IntcodeMachine(inputs);
            machine.input.Enqueue(5);
            machine.runToEnd();
            machine.printOutput(); // Part 2. Answer: 13758663
        }