I am in the process of writing a lexer for a text based game. A simplified example of what my code looks like this:
class Character:
def goWest(self, location):
self.location == location.getWest() #getWest() would be defined in the location class
x = raw_input("What action would you like to take")
With this code, I would like the player to enter something like: "Go West" and have a separate function take the substring "West", and then call the goWest() method for that Character.