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 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 (without weights) from the file in the first argument. Then, read strings from the
standard input. If a string is standard input. If a string is
accepted by the automated, write YES, a space and the string on the accepted by the automaton, write TRUE, a space and the string on the
standard output, otherwise — write NO, a space and the string. 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. 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. are no cycles with epsilon transition.
Your program does not have to check whether the description is correct Your program does not have to check whether the description is correct
and whether the automaton is deterministic. You can assume that the and whether the automaton is deterministic.
automaton does not contain epsilon transitions.
POINTS: 3 POINTS: 3
DEADLINE: 2023-11-12 23:59:59 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: for task_set in task_sets:
try: try:
with open(Path(dir, f'{task_set}.in')) as f_in, open(Path(dir, f'{task_set}.out'), 'w') as f_out: 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'): if str(dir).startswith('TaskH'):
compilation_command = ['thraxcompiler', f'--input_grammar={Path(dir, "grammar.grm")}', compilation_command = ['thraxcompiler', f'--input_grammar={Path(dir, "grammar.grm")}',
f'--output_far={Path(dir, "grammar.far")}'] f'--output_far={Path(dir, "grammar.far")}']
@ -39,7 +41,7 @@ def get_index():
def is_task_set_correct(dir, task_set): def is_task_set_correct(dir, task_set):
try: 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_out_lines = ''.join(f_out.readlines())
f_exp_lines = ''.join(f_exp.readlines()) f_exp_lines = ''.join(f_exp.readlines())
return f_out_lines == f_exp_lines return f_out_lines == f_exp_lines