summaryrefslogtreecommitdiff
path: root/src/room.py
diff options
context:
space:
mode:
authorJeff Armstrong <jeff@approximatrix.com>2013-07-24 15:26:57 -0400
committerJeff Armstrong <jeff@approximatrix.com>2013-07-24 15:26:57 -0400
commitca7982703591629ff73a8617e72c9496e9e92ab5 (patch)
treeeebd5e528318b478c894cb171312412de55bacec /src/room.py
parente3ebcb1ad2f1e7ca946a820c49b7e78e07d5cd8c (diff)
downloadpyohio2013-ca7982703591629ff73a8617e72c9496e9e92ab5.tar.gz
pyohio2013-ca7982703591629ff73a8617e72c9496e9e92ab5.zip
Initial skeleton uploaded.
Diffstat (limited to 'src/room.py')
-rw-r--r--src/room.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/room.py b/src/room.py
new file mode 100644
index 0000000..9aba006
--- /dev/null
+++ b/src/room.py
@@ -0,0 +1,25 @@
+
+class Room():
+ def __init__(self, id=0, name="A Room", description="An empty room", neighbors={}):
+ self.id = id
+ self.name = name
+ self.description = description
+ self.neighbors = neighbors
+
+ def _neighbor(self, direction):
+ if direction in self.neighbors:
+ return self.neighbors[direction]
+ else:
+ return None
+
+ def north(self):
+ return self._neighbor('n')
+
+ def south(self):
+ return self._neighbor('s')
+
+ def east(self):
+ return self._neighbor('e')
+
+ def west(self):
+ return self._neighbor('w')