Optimised reverse method (I have proofs of speed) (I have been slightly mistaken).
This commit is contained in:
parent
f747e3b530
commit
ede83eeb8e
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue