Commit d008f682 authored by Vladimír Štill's avatar Vladimír Štill
Browse files

checker: Don't canonise too eagerly

parent 96271653
...@@ -79,21 +79,22 @@ def check_task(automaton: Union[reg.DFA, reg.NFA], task: str) -> str: ...@@ -79,21 +79,22 @@ def check_task(automaton: Union[reg.DFA, reg.NFA], task: str) -> str:
if task == "MIN" and not automaton.is_minimal(): if task == "MIN" and not automaton.is_minimal():
output = "DFA není minimální." output = "DFA není minimální."
canonical = automaton.is_canonical() if task in {"CAN", "TOC", "MIC"}:
if task == "CAN" and not canonical: canonical = automaton.is_canonical()
output = "DFA není kanonický." if task == "CAN" and not canonical:
output = "DFA není kanonický."
if task == "TOC" and (not automaton.is_total() or not canonical):
if not automaton.is_total(): if task == "TOC" and (not automaton.is_total() or not canonical):
output = "DFA není totální. " if not automaton.is_total():
if not canonical: output = "DFA není totální. "
output += "DFA není kanonický." if not canonical:
output += "DFA není kanonický."
if task == "MIC" and (not automaton.is_minimal() or not canonical):
if not automaton.is_minimal(): if task == "MIC" and (not automaton.is_minimal() or not canonical):
output = "DFA není minimální. " if not automaton.is_minimal():
if not canonical: output = "DFA není minimální. "
output += "DFA není kanonický." if not canonical:
output += "DFA není kanonický."
return output return output
......
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