'hm'
This commit is contained in:
parent
971ff7fd4f
commit
75b7052e7c
@ -38,14 +38,15 @@ class automata:
|
||||
# for all values in text
|
||||
for i in text:
|
||||
# for all actual states
|
||||
result = []
|
||||
for q in self.state:
|
||||
# move state to its transition
|
||||
q = self.get_node_transition(q, i)
|
||||
result = self.get_node_transition(q, i)
|
||||
# if the list is empty, return false
|
||||
if not self.state:
|
||||
return False
|
||||
# flatten list of states
|
||||
self.state = [item for sublist in self.state for item in sublist]
|
||||
self.state = [item for sublist in result for item in sublist]
|
||||
print(self.state, i)
|
||||
# check if automata is in accepting state
|
||||
return self.check_if_accepted()
|
||||
@ -58,16 +59,12 @@ class automata:
|
||||
result = []
|
||||
# if the node exists
|
||||
if self.graph[q]:
|
||||
print(self.graph[q])
|
||||
# search through all its connections to find value
|
||||
for connections in self.graph[q]:
|
||||
print(connections)
|
||||
for value in connections:
|
||||
print(value, i)
|
||||
if value == i:
|
||||
# append next node
|
||||
result.append(connections[value])
|
||||
print(result)
|
||||
# return list of next nodes
|
||||
return result
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user