From f89cde0eb4f11d525acdaa2bb0edbe8c48117dc3 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Sat, 5 Jan 2013 16:10:21 +0000 Subject: Add initial documentation --- weatbag/__init__.py | 4 ++++ weatbag/words.py | 9 +++++++++ 2 files changed, 13 insertions(+) (limited to 'weatbag') 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'} -- cgit v1.3