def check_block( self, (x, y) ):
"""
Check if the x, y coordinate can have a block placed there.
That is; if there is a 'landed' block there or it is outside the
board boundary, then return False, otherwise return true.
"""
if x < 0 or x >= self.max_x or y < 0 or y >= self.max_y:
return False
elif self.landed.has_key( (x, y) ):
return False
else:
return True
Here there is syntax error in def
part, (x,y)
... So how could I fix it?
Seems like tuple parameter unpacking was removed in Python 3.
So this code
Works in Python 2.7
but fails in Python 3
You can also see this with the
-3
option in Python 2: