diff options
| author | Thomas Kluyver <takowl@gmail.com> | 2013-01-05 16:10:21 +0000 |
|---|---|---|
| committer | Thomas Kluyver <takowl@gmail.com> | 2013-01-05 16:10:21 +0000 |
| commit | f89cde0eb4f11d525acdaa2bb0edbe8c48117dc3 (patch) | |
| tree | d792bcad6a872a9158dfe8c091405c01335c6156 /weatbag/__init__.py | |
| parent | ba2ade314b07f7e16b7860afc621df02f3df46b8 (diff) | |
Add initial documentation
Diffstat (limited to 'weatbag/__init__.py')
| -rw-r--r-- | weatbag/__init__.py | 4 |
1 files changed, 4 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]) |
