From 5e460ef202844449aba0ed433f4407ee191b0772 Mon Sep 17 00:00:00 2001 From: IgnBys Date: Wed, 1 Nov 2023 23:04:51 +0100 Subject: [PATCH] Edited TaskB00 and edded READ file --- TaskB00/READ_HowToRun.txt | 2 ++ TaskB00/run.py | 13 +++++++------ TaskB00/test1.out | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 TaskB00/READ_HowToRun.txt diff --git a/TaskB00/READ_HowToRun.txt b/TaskB00/READ_HowToRun.txt new file mode 100644 index 0000000..ce46711 --- /dev/null +++ b/TaskB00/READ_HowToRun.txt @@ -0,0 +1,2 @@ +If you use windows please write this command in terminal: +python .\run.py .\fsa_description.arg .\test1.in .\test1.out \ No newline at end of file diff --git a/TaskB00/run.py b/TaskB00/run.py index d0829a5..40d8767 100644 --- a/TaskB00/run.py +++ b/TaskB00/run.py @@ -1,17 +1,18 @@ import sys def write_answer(answer): - with open('test1.out', 'a') as file: + with open(output_file, 'a') as file: file.write(answer+'\n') def find_next_position(position, character): - with open('fsa_description.arg', 'r') as readed_used_table: + with open(used_table, 'r') as readed_used_table: for row_used_table in readed_used_table: line = row_used_table.strip().split('\t') if position == line[0] and character == line[2]: return True,line[1] -# used_table = sys.argv[1] -# input_file = sys.argv[2] -with open('test1.out', 'w') as readed_output_file: - with open('test1.in', 'r') as readed_input_file: +used_table = sys.argv[1] +input_file = sys.argv[2] +output_file = sys.argv[3] +with open(output_file, 'w') as readed_output_file: + with open(input_file, 'r') as readed_input_file: for row_input_file in readed_input_file: result = False next_position = None diff --git a/TaskB00/test1.out b/TaskB00/test1.out index 680815f..4c1a9bc 100644 --- a/TaskB00/test1.out +++ b/TaskB00/test1.out @@ -6,3 +6,4 @@ NO NO NO NO +NO