This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Message(object): | |
def __init__(self, string): | |
self.breakdown = [] | |
self.tokens = {} | |
for part in string.split('{'): | |
self.breakdown.extend(part.split('}')) | |
for i, part in enumerate(self.breakdown): | |
if i % 2 == 1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commands = ["look", "smell"] | |
def make_room(description, exits): | |
def room(skip = False, command = ""): | |
if not skip or command == "look": | |
print description | |
print "You can go: " + ",".join(exits.keys()) | |
if command in exits.keys(): | |
return rooms[exits[command]] | |
if command and command not in commands: | |
print "I don't understand that." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inc = function(x) { | |
return x + 1; | |
}; | |
square = function(x) { | |
return x * x; | |
}; | |
cube = function(x) { | |
return x * x * x; |
NewerOlder