summaryrefslogtreecommitdiffstats
path: root/weatbag
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2013-01-05 16:10:21 +0000
committerThomas Kluyver <takowl@gmail.com>2013-01-05 16:10:21 +0000
commitf89cde0eb4f11d525acdaa2bb0edbe8c48117dc3 (patch)
treed792bcad6a872a9158dfe8c091405c01335c6156 /weatbag
parentba2ade314b07f7e16b7860afc621df02f3df46b8 (diff)
Add initial documentation
Diffstat (limited to 'weatbag')
-rw-r--r--weatbag/__init__.py4
-rw-r--r--weatbag/words.py9
2 files changed, 13 insertions, 0 deletions
diff --git a/weatbag/__init__.py b/weatbag/__init__.py
index 6c8ed1b..7212bfa 100644
--- a/weatbag/__init__.py
+++ b/weatbag/__init__.py
@@ -10,6 +10,7 @@ class Player:
self.position = (0,0)
def has(self, item):
+ "Does the player have any of item?"
return self.inventory[item] > 0
def give(self, item, n=1):
@@ -64,6 +65,9 @@ def main():
while True:
do = action.get_action()
if action.is_move(do):
+ # check if we can leave tile
+ if not getattr(tile, 'leave', lambda p,d: True)(player, do[1]):
+ continue
# move
n,e = player.position
dn, de = action.process_move(do[1])
diff --git a/weatbag/words.py b/weatbag/words.py
index 8212657..11ede7d 100644
--- a/weatbag/words.py
+++ b/weatbag/words.py
@@ -1,3 +1,12 @@
+"""A thesaurus of words the player might use, so you can easily accept
+synonyms of the word you want.
+
+e.g. This will recognise take, pick, get or collect::
+
+ if do[0] in weatbag.words.take:
+ #...
+"""
+
move = {'move','walk','go'}
give = {'give', 'feed', 'present'}
use = {'eat', 'use', 'wear'}