remove redundant method: BasicRegister.compact_str()
This commit is contained in:
parent
4e0e30383d
commit
9e06a93c19
|
@ -22,9 +22,6 @@ class BasicRegister:
|
|||
def __len__(self) -> int:
|
||||
return len(self.memory)
|
||||
|
||||
def compact_str(self) -> str:
|
||||
return "".join([str(int(value)) for value in self.memory])
|
||||
|
||||
def adjusted_by_size(self, resulting_size: int) -> Self:
|
||||
"""
|
||||
Adjusts a register to a given size.
|
||||
|
@ -93,9 +90,6 @@ class Counter:
|
|||
def __len__(self) -> int:
|
||||
return len(self.memory)
|
||||
|
||||
def compact_str(self) -> str:
|
||||
return "".join([str(int(value)) for value in self.memory])
|
||||
|
||||
def decrement(self):
|
||||
self.memory = binary_subtraction(self, BasicRegister([False] * (len(self.memory) - 1) + [True])).memory
|
||||
|
||||
|
|
8
main.py
8
main.py
|
@ -19,16 +19,16 @@ def input_handler(first_register: bu.BasicRegister, second_register: bu.BasicReg
|
|||
match input("Choose method to use (1-4):\n>>> "):
|
||||
case "1":
|
||||
result, data_table = bu.binary_multiplication_method_1(first_register, second_register)
|
||||
print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result.compact_str()}")
|
||||
print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result}")
|
||||
case "2":
|
||||
result, data_table = bu.binary_multiplication_method_2(first_register, second_register)
|
||||
print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result.compact_str()}")
|
||||
print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result}")
|
||||
case "3":
|
||||
result, data_table = bu.binary_multiplication_method_3(first_register, second_register)
|
||||
print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result.compact_str()}")
|
||||
print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result}")
|
||||
case "4":
|
||||
result, data_table = bu.binary_multiplication_method_4(first_register, second_register)
|
||||
print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result.compact_str()}")
|
||||
print(f"Multiplication:\n{bu.format_device_state_table(data_table)}\nResult: {result}")
|
||||
case _:
|
||||
print("Such method does not exist, try again.")
|
||||
case "d":
|
||||
|
|
Loading…
Reference in New Issue