public string SolvePartTwo() { // Solved it by hand... var codes = new Dictionary <string, string>() { { "A", "L,4,L,6,L,8,L,12\n" }, { "B", "L,8,R,12,L,12\n" }, { "C", "R,12,L,6,L,6,L,8\n" } }; var sequence = "A,B,B,A,B,C,A,C,B,C\n"; var input = sequence.ToCharArray().Select(i => (long)i).ToList(); input.AddRange(codes["A"].ToCharArray().Select(i => (long)i).ToList()); input.AddRange(codes["B"].ToCharArray().Select(i => (long)i).ToList()); input.AddRange(codes["C"].ToCharArray().Select(i => (long)i).ToList()); input.AddRange("n\n".ToCharArray().Select(i => (long)i).ToList()); IntCodeVMDay17 computer = new IntCodeVMDay17(this.values, input); computer.memory[0] = 2; while (!computer.isDone) { computer.Process(); } return(computer.outputs.Last().ToString()); }
private Dictionary <(int x, int y), int> runProgram(List <long> input) { Dictionary <(int x, int y), int> scaffolding = new Dictionary <(int x, int y), int>(); IntCodeVMDay17 computer = new IntCodeVMDay17(this.values, input); int row = 0; int col = 0; while (!computer.isDone) { computer.Process(); switch (computer.outputs.Last()) { case 35: scaffolding[(col, row)] = 1;