Commit 8197cb07 authored by Kateřina Sloupová's avatar Kateřina Sloupová
Browse files

add canonization and cleanup

parent 00ac104d
Pipeline #62608 passed with stage
in 58 seconds
......@@ -181,7 +181,7 @@ class WebChecker:
picture = "s_in_t"
else:
print(self.eq.left_counterexample, self.eq.right_counterexample)
#print(self.eq.left_counterexample, self.eq.right_counterexample)
picture = "eq"
self.languages[0] = self.language(teacher.complement())
self.languages[1] = self.teacher
......
......@@ -138,6 +138,7 @@ def main():
task_prefix, teacher_string = teacher_string.split(":", 1)
teacher_type, task = get_task(task_prefix)
# When time comes, teacher's solution can surely be also GRA or REG, see web_checker.
if teacher_type == "DFA" or teacher_type == "NFA":
dfa_task(teacher_type=teacher_type, teacher_string=teacher_string,
task=task, student_string=student_string)
......
......@@ -178,7 +178,8 @@ class DFA:
state_2 not in dfa_2.final:
final.add(state)
return DFA(states, characters, transition, init, final)
dfa = DFA(states, characters, transition, init, final)
return dfa.eliminate_unreachable().canonize()
@staticmethod
def union(dfa_1: DFA, dfa_2: DFA) -> DFA:
......@@ -272,7 +273,7 @@ class DFA:
dfa.final.add(new_state)
dfa.transition = new_transition
return dfa
return dfa.canonize()
def rename_state(self, rename: State, name: str):
if name == rename.name:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment