add Task211.py
This commit is contained in:
parent
bf7cff3f0f
commit
f87398e70c
41
automata/Task211.py
Normal file
41
automata/Task211.py
Normal file
@ -0,0 +1,41 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
Rozwiązanie zadania 211
|
||||
"""
|
||||
|
||||
from deterministic_automaton import DeterministicAutomaton
|
||||
|
||||
def kot_automaton():
|
||||
automaton = DeterministicAutomaton()
|
||||
|
||||
state_a = automaton.add_state()
|
||||
state_b = automaton.add_state()
|
||||
state_c = automaton.add_state()
|
||||
state_d = automaton.add_state()
|
||||
state_e = automaton.add_state()
|
||||
state_f = automaton.add_state()
|
||||
state_g = automaton.add_state()
|
||||
state_h = automaton.add_state()
|
||||
state_i = automaton.add_state()
|
||||
state_z = automaton.add_state()
|
||||
|
||||
automaton.mark_as_initial(state_a)
|
||||
automaton.mark_as_final(state_z)
|
||||
|
||||
automaton.add_transition(state_a, 'k', state_b)
|
||||
automaton.add_transition(state_b, 'o', state_c)
|
||||
automaton.add_transition(state_b, 'a', state_d)
|
||||
automaton.add_transition(state_c, 's', state_z)
|
||||
automaton.add_transition(state_c, 't', state_z)
|
||||
automaton.add_transition(state_d, 't', state_z)
|
||||
|
||||
automaton.add_transition(state_a, 'l', state_e)
|
||||
automaton.add_transition(state_e, 'a', state_f)
|
||||
automaton.add_transition(state_e, 'o', state_f)
|
||||
automaton.add_transition(state_f, 't', state_z)
|
||||
|
||||
|
||||
return automaton
|
||||
|
Loading…
Reference in New Issue
Block a user