def getAmpOutput(self, line: str, phases: Iterable[int]): io = [0] for phase in phases: inputs = [phase] inputs.extend(io) io = processWithIntCodeComputer(line, inputs)[1] return io.pop(0)
def test(self): self.checkIntCodeComputerProgram( '109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99', '109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99', [1]) self.checkIntCodeComputerOutput0(1125899906842624, '104,1125899906842624,99', [1]) self.assertEqual( 16, len( str( processWithIntCodeComputer( '1102,34915192,34915192,7,4,7,99,0', [1])[1][0])))
def test(self): self.coreTest(self.process) self.coreTest(lambda line: processWithIntCodeComputer(line, [0])[0] ) # general solution from day 5 works, too
def process(self, line: str): tiles = processWithIntCodeComputer(line, [])[1] blockCount = count(tile for tile in tiles[::3] if tile == 2) return blockCount
def process(self, line: str): intCodeOutput = processWithIntCodeComputer(line, [])[1] return sum(getAlignmentParameters(intCodeOutput))
def process(self, line: str): springScript = [] # TODO intCodeInputs = springScriptToIntCodeInputs(springScript) return processWithIntCodeComputer(line, intCodeInputs)[1][0]
def process(self, line: str): boostKeyCode = processWithIntCodeComputer(line, [1])[1] return boostKeyCode
def process(self, line: str): diagnosticCode = processWithIntCodeComputer(line, [1])[1] return diagnosticCode
def process(self, line: str): result = sum( processWithIntCodeComputer(line, [x, y])[1][0] for x in range(50) for y in range(50)) return result