forked from jon-jacky/PyModel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpeedControl.py
More file actions
33 lines (24 loc) · 816 Bytes
/
SpeedControl.py
File metadata and controls
33 lines (24 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# pma --maxTransitions 100 --output SpeedControl SpeedControl
# 3 states, 3 transitions, 1 accepting states, 0 unsafe states, 0 finished and 0 deadend states
# actions here are just labels, but must be symbols with __name__ attribute
def IncrementSpeed(): pass
# states, key of each state here is its number in graph etc. below
states = {
0 : {'SpeedControl': 0},
1 : {'SpeedControl': 1},
2 : {'SpeedControl': 2},
}
# initial state, accepting states, unsafe states, frontier states, deadend states
initial = 0
accepting = [0]
unsafe = []
frontier = []
finished = []
deadend = []
runstarts = [0]
# finite state machine, list of tuples: (current, (action, args, result), next)
graph = (
(0, (IncrementSpeed, (), None), 1),
(1, (IncrementSpeed, (), None), 2),
(2, (IncrementSpeed, (), None), 0),
)