'hm'
This commit is contained in:
parent
075301248c
commit
03b07b1d4f
10
TaskB01/run
10
TaskB01/run
@ -41,8 +41,12 @@ class automata:
|
|||||||
for q in self.state:
|
for q in self.state:
|
||||||
# move state to its transition
|
# move state to its transition
|
||||||
q = self.get_node_transition(q, i)
|
q = self.get_node_transition(q, i)
|
||||||
|
# if the list is empty, return false
|
||||||
if not self.state:
|
if not self.state:
|
||||||
return False
|
return False
|
||||||
|
# flatten list of states
|
||||||
|
self.state = [item for sublist in self.state for item in sublist]
|
||||||
|
# check if automata is in accepting state
|
||||||
return self.check_if_accepted()
|
return self.check_if_accepted()
|
||||||
|
|
||||||
# check if there is common part between states of automata and accepting states
|
# check if there is common part between states of automata and accepting states
|
||||||
@ -55,11 +59,11 @@ class automata:
|
|||||||
if self.graph[q]:
|
if self.graph[q]:
|
||||||
# search through all its connections to find value
|
# search through all its connections to find value
|
||||||
for transition in self.graph[q]:
|
for transition in self.graph[q]:
|
||||||
print(transition)
|
|
||||||
# if value is like searched for
|
# if value is like searched for
|
||||||
if transition[0] == i:
|
for key in transition:
|
||||||
|
if key == i:
|
||||||
# append next node
|
# append next node
|
||||||
result.append(transition[1])
|
result.append(transition[key])
|
||||||
# return list of next nodes
|
# return list of next nodes
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user