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 ++++ 1 file changed, 4 insertions(+) (limited to 'weatbag/__init__.py') 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]) -- cgit v1.3