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