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

evalweb: More options and less hidden conversions in convert

parent f56fd4a7
Pipeline #66944 failed with stage
in 48 seconds
......@@ -24,8 +24,8 @@ tasks = {'DFA': 'DFA',
convs = {'DFA': 'DFA',
'TOT': 'Totální DFA',
'MIN': 'Minimální DFA',
# 'CAN': 'Kanonický automat', # TODO
# 'MIC': 'Mininální kanonický automat', # TODO
'CAN': 'Kanonický automat',
'MIC': 'Mininální kanonický automat',
'EFA': 'NFA (s ε-kroky)',
'NFA': 'NFA bez ε-kroků',
'GRA': 'Regulární gramatika'}
......@@ -128,14 +128,22 @@ class WebChecker:
def convert(self, student_type: str) -> str:
parser = Parser()
if self.task in {"DFA", "TOT", "MIN"}:
if self.task in {"DFA", "TOT", "MIN", "CAN", "MIC"}:
dfa = dfa_transform(self.student_string, student_type)
# avoid confusion by making the automaton total if the input
# formalism was not already DFA
if student_type != "DFA":
dfa =
if self.task == "DFA":
return parser.dfa_to_str(dfa.canonize())
return parser.dfa_to_str(dfa)
if self.task == "TOT":
return parser.dfa_to_str(
return parser.dfa_to_str(
if self.task == "CAN":
return parser.dfa_to_str(dfa.canonize())
if self.task == "MIN":
return parser.dfa_to_str(dfa.minimize())
if self.task == "MIC":
return parser.dfa_to_str(dfa.minimize().canonize())
nfa = nfa_transform(self.student_string, student_type)
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