-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfsm.py
55 lines (48 loc) · 770 Bytes
/
fsm.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'''
@Copyright (c) 2019, Ryo Currency Project
@Author Max Base, Asrez Team
@Version 1.0
@Date 2019-11-02
Please see LICENSE for details
All rights reserved.
'''
import enum
class State(enum.Enum):
OPEN = 0
LOCKED = 1
# default setting
state=State.OPEN
# price=30
# Pay Money
def coin():
global state
# global price
# if price > 10:
# price=price-10
# state = State.OPEN
# push()
# else:
# print("You not have money, Charge it!")
if state == State.LOCKED:
state = State.OPEN
else:
return
# Cross the road
def push():
global state
if state == State.LOCKED:
print("You cannot cross from the road!")
return
else:
print("You cross from the road.")
state=State.LOCKED
coin()
coin()
coin()
coin()
coin()
coin()
push()
push()
push()
push()