-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller.py
27 lines (22 loc) · 891 Bytes
/
controller.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from errors import DifferentLengthException
from errors import ImplicantCoverageException
from errors import ShortImplicantException
from errors import NotImplicantException
from table import Table
def execute_minimization(obl_imps: list[str], sup_imps: list[str]):
try:
table = Table(obl_imps, sup_imps)
table.reduce()
table.consume()
table.cover()
print(table.visualize_reduction())
print(table.visualize_coverage())
except DifferentLengthException:
print("Entered implicants have different length.")
except ShortImplicantException:
print("Entered implicants are shorter than 3.")
except ImplicantCoverageException:
print("Something has gone wrong."
"Prime implicants can not cover original implicant.")
except NotImplicantException:
print("Entered invalid implicant.")