Esempio n. 1
0
            public void Part1_QuineSelfReplicating()
            {
                var intcode  = new long[] { 109, 1, 204, -1, 1001, 100, 1, 100, 1008, 100, 16, 101, 1006, 101, 0, 99 };
                var compiler = new IntCodeCompiler();

                compiler.Compute(new IntCodeProgram(intcode.ToArray(), 0));
                IntCodeToBasic.ConvertWhileRunning(intcode.ToArray(), "Day9_Part1_QuineSelfReplicating.txt", false);
                TestUtility.AreEqual(intcode, compiler.OutputValues.ToArray());
            }
Esempio n. 2
0
    public static string Part1(string inputText)
    {
        var intcode  = InputParser.ListOfLongs(inputText, ',');
        var compiler = new IntCodeCompiler(1);
        var program  = new IntCodeProgram(intcode, 0);

        compiler.Compute(program);
        IntCodeToBasic.Convert(program, "D5Part1HumainCode.txt");

        return(compiler.OutputConcat);
    }
Esempio n. 3
0
            public void Part1()
            {
                var intcode = InputParser.ListOfLongs(Day9Input, ',');

                IntCodeToBasic.ConvertWhileRunning(new IntCodeCompiler(1), new IntCodeProgram(intcode.ToArray(), 0), "D9Part1_HumainCode.txt", false);

                var compiler = new IntCodeCompiler(1);

                compiler.Compute(new IntCodeProgram(intcode, 0));

                Assert.AreEqual(3533056970, compiler.OutputValue);
            }
Esempio n. 4
0
    public static string Part2(string inputText)
    {
        var intcode = InputParser.ListOfLongs(inputText, ',');

        IntCodeToBasic.ConvertWhileRunning(new IntCodeCompiler(5), new IntCodeProgram(intcode.ToArray(), 0), "D5Part2HumainCode.txt", true);

        var compiler = new IntCodeCompiler(5);

        compiler.Compute(new IntCodeProgram(intcode, 0));

        return(compiler.OutputConcat);
    }