Remove debug prints from day 5
This commit is contained in:
parent
3178d9cfc2
commit
ba452634ba
|
@ -75,17 +75,13 @@ class Operation:
|
||||||
# Add 1 to move past the opcode itself
|
# Add 1 to move past the opcode itself
|
||||||
pointer = instruction_pointer + i + 1
|
pointer = instruction_pointer + i + 1
|
||||||
arg = memory[pointer]
|
arg = memory[pointer]
|
||||||
print(f"raw_arg={arg}")
|
|
||||||
if mode == Operation.MODE_PARAMETER:
|
if mode == Operation.MODE_PARAMETER:
|
||||||
print(f"Resolving {arg} to {memory[arg]}")
|
|
||||||
arg = memory[arg]
|
arg = memory[arg]
|
||||||
elif mode != Operation.MODE_IMMEDIATE:
|
elif mode != Operation.MODE_IMMEDIATE:
|
||||||
raise ValueError(f"Invalid parameter mode {mode}")
|
raise ValueError(f"Invalid parameter mode {mode}")
|
||||||
|
|
||||||
args.append(arg)
|
args.append(arg)
|
||||||
|
|
||||||
print("MODES:", self.modes)
|
|
||||||
print("ARGS:", args)
|
|
||||||
func = OPERATION_FUNCS[self.opcode]
|
func = OPERATION_FUNCS[self.opcode]
|
||||||
if program_input is not None:
|
if program_input is not None:
|
||||||
jump_addr = func(memory, program_input, *args)
|
jump_addr = func(memory, program_input, *args)
|
||||||
|
@ -100,17 +96,14 @@ class Operation:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add(memory: List[int], a: int, b: int, loc: int) -> None:
|
def add(memory: List[int], a: int, b: int, loc: int) -> None:
|
||||||
memory[loc] = a + b
|
memory[loc] = a + b
|
||||||
print(f"{a} + {b} => {memory[loc]} @ {loc}")
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def multiply(memory: List[int], a: int, b: int, loc: int) -> None:
|
def multiply(memory: List[int], a: int, b: int, loc: int) -> None:
|
||||||
memory[loc] = a * b
|
memory[loc] = a * b
|
||||||
print(f"{a} * {b} => {memory[loc]} @ {loc}")
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def input(memory: List[int], program_input: int, loc: int) -> None:
|
def input(memory: List[int], program_input: int, loc: int) -> None:
|
||||||
memory[loc] = program_input
|
memory[loc] = program_input
|
||||||
print(f"{program_input} => {memory[loc]} @ {loc}")
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def output(memory: List[int], value: int) -> None:
|
def output(memory: List[int], value: int) -> None:
|
||||||
|
|
Loading…
Reference in a new issue