Add Before/After prints

This commit is contained in:
flyingscorpio@arch-desktop 2022-01-15 14:01:03 +01:00
parent 9b6d9b47de
commit a1f1a1269d
2 changed files with 18 additions and 2 deletions

View file

@ -399,13 +399,15 @@ class Automate:
"""Make automate recognize the complementary language"""
if not self.is_deterministe():
print("Determinizing")
self.determinize()
assert self.is_deterministe()
self.print_transition_table()
if not self.is_complete():
print("Completing")
self.complete()
assert self.is_complete()
self.print_transition_table()
self.print_transition_table()
current_non_terminal_states = [
state for state in self.states if state not in self.terminal_states

View file

@ -56,32 +56,46 @@ def main() -> None:
else:
print("Non accepté")
elif command == "determinize":
print("Avant :")
automate.print_transition_table()
automate.determinize()
print("Après :")
automate.print_transition_table()
elif command == "complete":
print("Avant :")
automate.print_transition_table()
automate.complete()
print("Après :")
automate.print_transition_table()
elif command == "minimize":
print("Avant :")
automate.print_transition_table()
automate.minimize()
print("Après :")
automate.print_transition_table()
elif command == "standardize":
print("Avant :")
automate.print_transition_table()
automate.standardize()
print("Après :")
automate.print_transition_table()
elif command == "add_empty_word":
print("Avant :")
automate.print_transition_table()
automate.add_empty_word()
print("Après :")
automate.print_transition_table()
elif command == "remove_empty_word":
print("Avant :")
automate.print_transition_table()
automate.remove_empty_word()
print("Après :")
automate.print_transition_table()
elif command == "to_complementary":
print("Avant :")
automate.print_transition_table()
automate.to_complementary()
print("Après :")
automate.print_transition_table()
elif command == "graph":
filename = automate_file.name