Skip to content

Instantly share code, notes, and snippets.

@chpapa
Created March 8, 2017 13:03
Show Gist options
  • Save chpapa/9eb9a82d5ee6f34ddea9a56404901f25 to your computer and use it in GitHub Desktop.
Save chpapa/9eb9a82d5ee6f34ddea9a56404901f25 to your computer and use it in GitHub Desktop.
from statemachine import StateMachine
print "Hi " + name + ", I am Ben."
contexts = {
"startups": "I'm Ben, co-founder of Oursky, which is a team of 40 developers and designers in Hong Kong and Taipei, we develop products for software developers.",
"ngo": "I run a small app studio, I’m also an advocate for creative commons, open data, citizen journalist and Internet freedom."
}
class BadDayStateMachine(StateMachine):
def __init__(self):
self.setInitialState("help")
def help(self):
print("So how are you doing?")
if input == "good":
self.transist("late")
def late(self):
print("Great! I am late for a meeting, let's catch up next time!")
print contexts[context]
BadDayStateMachine().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment