This commit is contained in:
Bartekfiolek 2023-11-12 15:41:40 +01:00
parent 10b976d87b
commit 403022723a
5 changed files with 7 additions and 13996 deletions

View File

@ -4,8 +4,8 @@ Deterministic automaton III
Read a description of a finite-state automaton in the AT&T format
(without weights) from the file in the first argument. Then, read strings from the
standard input. If a string is
accepted by the automated, write YES, a space and the string on the
standard output, otherwise — write NO, a space and the string.
accepted by the automaton, write TRUE, a space and the string on the
standard output, otherwise — write FALSE, a space and the string.
If there is a non-determinism in the automaton, the first transition should be chosen.
@ -17,8 +17,7 @@ is at most one epsilon transition from a given state and that there
are no cycles with epsilon transition.
Your program does not have to check whether the description is correct
and whether the automaton is deterministic. You can assume that the
automaton does not contain epsilon transitions.
and whether the automaton is deterministic.
POINTS: 3
DEADLINE: 2023-11-12 23:59:59

View File

@ -1 +0,0 @@
a

File diff suppressed because it is too large Load Diff

View File

View File

@ -11,7 +11,9 @@ def execute_task(dir):
for task_set in task_sets:
try:
with open(Path(dir, f'{task_set}.in')) as f_in, open(Path(dir, f'{task_set}.out'), 'w') as f_out:
arg = [x for x in dir.iterdir() if str(x).endswith('.arg')] # arg = [x for x in dir.iterdir() if str(x).endswith(f'{task_set}.arg')]
arg = [x for x in dir.iterdir() if str(x).endswith(f'{task_set}.arg')] # arg = [x for x in dir.iterdir() if str(x).endswith(f'{task_set}.arg')]
if not arg:
arg = [x for x in dir.iterdir() if str(x).endswith('fsa_description.arg')] # arg = Path(dir, 'fsa_description.arg') #
if str(dir).startswith('TaskH'):
compilation_command = ['thraxcompiler', f'--input_grammar={Path(dir, "grammar.grm")}',
f'--output_far={Path(dir, "grammar.far")}']
@ -39,7 +41,7 @@ def get_index():
def is_task_set_correct(dir, task_set):
try:
with open(Path(dir, f'{task_set}.out')) as f_exp, open(Path(dir, f'{task_set}.exp')) as f_out:
with open(Path(dir, f'{task_set}.out')) as f_out, open(Path(dir, f'{task_set}.exp')) as f_exp:
f_out_lines = ''.join(f_out.readlines())
f_exp_lines = ''.join(f_exp.readlines())
return f_out_lines == f_exp_lines