fix first division method, ready for merging

This commit is contained in:
dymik739 2023-07-29 20:50:40 +03:00
parent 91fc4084e1
commit f31491cdad
2 changed files with 2 additions and 4 deletions

View File

@ -437,9 +437,9 @@ def binary_division_method_1(first_term: BasicRegister, second_term: BasicRegist
rg2, _ = binary_subtraction_second_complement(rg2, rg1)
data_table[-1].append(list(map(str, [i, rg3, rg2, rg1, "RG2 := RG2 - RG1"])))
rg3.left_shift(rg2.memory[0])
rg3.left_shift(not rg2.memory[0])
rg2.left_shift()
data_table[-1].append(list(map(str, [i, rg3, rg2, rg1, f"RG3 := l(RG3).RG2[{n+2}]\nRG2 := l(RG2).0"])))
data_table[-1].append(list(map(str, [i, rg3, rg2, rg1, f"RG3 := l(RG3).!RG2[{n+2}]\nRG2 := l(RG2).0"])))
return BasicRegister(deque(list(rg3.memory)[1:])), data_table

View File

@ -34,8 +34,6 @@ def input_handler(first_register: bu.BasicRegister, second_register: bu.BasicReg
case "d":
match input("Choose method to use (1-2):\n>>> "):
case "1":
# Warn about development
print("WARNING: this method is still being figured out, wrong results to be expected for now.")
result, data_table = bu.binary_division_method_1(first_register, second_register)
print(f"Division:\n{bu.format_device_state_table(data_table)}\nResult: {result}")
case "2":