Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/game.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-04-01 16:04:09 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-04-01 16:04:09 (GMT)
commitd58f3617427f9fb37760a57028db92fce3e33f0a (patch)
tree7ba572c3dd6c7ad192cf2b11d3f1c62da592a8c4 /game.py
parentebef87c6b5ee4351f7f55b0e5496385b5fa9fd2c (diff)
fixed bounds-check error that was preventing blank-tile display in position 8
Diffstat (limited to 'game.py')
-rw-r--r--game.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/game.py b/game.py
index 6592b5f..f7b447e 100644
--- a/game.py
+++ b/game.py
@@ -485,16 +485,22 @@ class Game():
return True
if self.grid.grid[tile] is not None: # already has a tile
return False
- if tile > COL and self.grid.grid[tile + OFFSETS[0]] is not None:
+ # Looking north
+ if tile >= COL and self.grid.grid[tile + OFFSETS[0]] is not None:
return True
+ # Looking east
if tile % ROW < ROW - 1 and \
self.grid.grid[tile + OFFSETS[1]] is not None:
return True
+ # Looking south
if tile < (ROW - 1) * COL and \
self.grid.grid[tile + OFFSETS[2]] is not None:
return True
+ # Looking west
if tile % ROW > 0 and self.grid.grid[tile + OFFSETS[3]] is not None:
return True
+ return False
+
def give_a_hint(self):
''' Try to find an open place on the grid for any tile in my_hand. '''