29 lines
939 B
Python
29 lines
939 B
Python
|
#!/usr/bin/python2
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
"""
|
||
|
Rozwiązanie zadania 203
|
||
|
"""
|
||
|
# from deterministic_automaton import DeterministicAutomaton
|
||
|
def get_number_of_transitions(automaton, symbol):
|
||
|
counter = 0
|
||
|
for state in range(automaton.get_number_of_states()):
|
||
|
# print state, symbol, automaton.get_target_state(state, symbol)
|
||
|
if automaton.get_target_state(state, symbol) != None:
|
||
|
counter += 1
|
||
|
# print counter
|
||
|
return counter
|
||
|
# if __name__ == '__main__':
|
||
|
# automaton = DeterministicAutomaton()
|
||
|
|
||
|
# state_a = automaton.add_state()
|
||
|
# state_b = automaton.add_state()
|
||
|
# state_c = automaton.add_state()
|
||
|
|
||
|
# automaton.mark_as_initial(state_b)
|
||
|
# automaton.mark_as_final(state_a)
|
||
|
# automaton.add_transition(state_b, 'b', state_a)
|
||
|
# automaton.add_transition(state_a, 'b', state_b)
|
||
|
# automaton.add_transition(state_c, 'b', state_a)
|
||
|
# get_number_of_transitions(automaton, 'a')
|