diff --git a/TaskB02/run.py b/TaskB02/run.py index 4683333..d0cf0e6 100644 --- a/TaskB02/run.py +++ b/TaskB02/run.py @@ -1,7 +1,7 @@ import re import sys -atandt_desc_pattern = re.compile(r"^([0-9]+) ([0-9]+) (\S+)( [0-9]+\.[0-9]+)?$") +atandt_desc_pattern = re.compile(r"^([0-9]+)[ \t]([0-9]+)[ \t](\S+)([ \t][0-9]+(\.[0-9]+)?)?$") #^([0-9]+)[ \t]([0-9]+)[ \t](\S+)([ \t][0-9]+(\.[0-9]+)?)?$ atandt_accepted_state_pattern = re.compile(r"^[0-9]+$") current_state = 0 diff --git a/TaskB05/run.py b/TaskB05/run.py index 5b65a82..d550433 100644 --- a/TaskB05/run.py +++ b/TaskB05/run.py @@ -3,7 +3,7 @@ import re import sys - +# Regex pattern for reading atandt format atandt_desc_pattern = re.compile(r"^([0-9]+)\t([0-9]+)\t(\S+)$") #^([0-9]+)\t([0-9]+)\t(\S+)$ regex for tab separated columns atandt_accepted_state_pattern = re.compile(r"^[0-9]+$") @@ -25,14 +25,14 @@ def dfs(graph, start): stack.add(el) while stack: edge = stack.pop() - print('Current edge: {edge}'.format(edge = edge)) + #print('Current edge: {edge}'.format(edge = edge)) if edge not in visited: visited.add(edge) children = set() for val in filter_set(state_move, edge[2]): stack.add(val) - print('Stack: {stack}'.format(stack = stack)) - print('Visited: {visited}'.format(visited = visited)) + #print('Stack: {stack}'.format(stack = stack)) + #print('Visited: {visited}'.format(visited = visited)) else: return [-1] return visited @@ -52,6 +52,6 @@ print('Accept states: {accept_states}'.format(accept_states = accept_states)) vis = dfs(state_move, 0) if -1 in vis: - print("Cycle") + print("TAK") else: - print("Tree") + print("NIE")