This commit is contained in:
deadsmond 2019-11-25 20:41:48 +01:00
parent 0da51d11d7
commit 1d555b2226

View File

@ -58,21 +58,12 @@ class automata:
result = []
# if the node exists
if self.graph[q]:
# search through all its to find value
for dic in self.graph[q]:
for element in dic:
print(element)
for transition in self.graph[q]:
print(transition, i)
try:
if transition[i]:
# search through all its connections to find value
for connections in self.graph[q]:
for value in connections:
if value == i:
# append next node
result.append(transition[i])
except KeyError:
# there is no value like that (element from the outside of alphabet)
return []
result.append(connections[value])
# return list of next nodes
return result