Coding a simple state machine in python
abhishek1899 at gmail.com
Tue Feb 25 02:30:26 CET 2014
How do I write a state machine in python? I have identified the states and the conditions. Is it possible to do simple a if-then-else sort of an algorithm? Below is some pseudo code:
if state == "ABC":
change state to DEF
if state == "DEF"
I have a class to which certain values are passed from a GUI and the functions above have to make use of those variables. How do I go about doing this? I have the following algorithm:
def __init__(self, var1, var2): #var1 and var2 are received from a GUI
self.var1 = var1
if state == "ABC"
Could someone point me in the right direction? Thank you!
More information about the Python-list