-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint_machine.py
More file actions
23 lines (21 loc) · 824 Bytes
/
print_machine.py
File metadata and controls
23 lines (21 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from transition_string import transition_string
def print_machine(config):
'''
print_machine simply prints the machine definition from the json in a
human readable format. For the transitions I use a for loop to print
every transition on a seperate line with the needed information.
'''
print(f"""******************************************
Machine name: {config['name']}
******************************************
Alphabet: {config['alphabet']}
Blank: '{config['blank']}'
States: {config['states']}
Initial: '{config['initial']}'
Finals: {config['finals']}
******************************************
Transitions:""")
for key in config['transitions'].items():
for item in key[1]:
print(transition_string(key[0], item))
print("******************************************")