procedural programming
functional programming
object-oriented programming
高级 state machine 抽象

例如:旋转栅门

输入=coin,turn,none
输出=enter,pay
状态=locked,unlocked
nextState(s,i)=⎩⎪⎨⎪⎧unlocked,locked,s,i=coini=turnotherwise
output(s,i)={enter,pay,if nextState(s,i)=unlockedotherwise

time |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
state |
locked |
locked |
unlocked |
unlocked |
locked |
locked |
unlocked |
input |
none |
coin |
none |
turn |
turn |
coin |
coin |
output |
pay |
enter |
enter |
pay |
pay |
enter |
enter |