Optimised reverse method (I have proofs of speed) (I have been slightly mistaken).

This commit is contained in:
Rhinemann 2023-06-25 22:57:12 +03:00
parent f747e3b530
commit ede83eeb8e
1 changed files with 1 additions and 2 deletions

View File

@ -15,8 +15,7 @@ class BasicRegister:
return f"Memory: {[int(value) for value in self.memory]}"
def reverse(self):
for i, value in enumerate(self.memory):
self.memory[i] = not value
self.memory = deque([not value for value in self.memory])
def left_shift(self, digit_to_fill: bool = False, steps_shifted: int = 1) -> deque[bool]:
self.memory.extend([digit_to_fill] * steps_shifted)