Exemplo n.º 1
0
 def walkable(self, tile):
     (x, y) = tup(tile)
     return True if x < w() and x >= 0 and y < h() and y >= 0 and\
                    self.v.get(num(x, y)) != TileType.WALL    and\
                    self.v.get(num(x, y)) != TileType.ROCK    and\
                    self.v.get(num(x, y)) != TileType.CLL        \
                 else False
Exemplo n.º 2
0
 def walkable(self, x, y):
     tile = self.v.get(num(x, y))
     return 0 <= x < w() and \
         0 <= y < h() and \
         tile != TT.WALL and \
         tile != TT.ROCK and \
         tile != TT.CLL
Exemplo n.º 3
0
 def walkable(self, x, y):
     tile = self.v.get(num(x, y))
     return 0 <= x < w() and \
         0 <= y < h() and \
         tile != TT.WALL and \
         tile != TT.ROCK and \
         tile != TT.CLL
Exemplo n.º 4
0
 def walkable(self, tile):
     (x, y) = tup(tile)
     tile_type = self.v.get(tile)
     return 0 <= x < w() and \
         0 <= y < h() and \
         tile_type != TT.WALL and \
         tile_type != TT.ROCK and \
         tile_type != TT.CLL
Exemplo n.º 5
0
 def walkable(self, x, y):
     return (
         True
         if x < w()
         and x >= 0
         and y < h()
         and y >= 0
         and self.v.get(num(x, y)) != TileType.WALL
         and self.v.get(num(x, y)) != TileType.ROCK
         and self.v.get(num(x, y)) != TileType.CLL
         else False
     )
Exemplo n.º 6
0
    def above_water(self):
        above = set()
        y = self.m.water + 1
        
        if y >= h():
            return None

        for x in range(w()):
            t = num(x, y)
            if self.walkable(t):
                above.add(t)
        return above
Exemplo n.º 7
0
    def above_water(self):
        above = set()
        y = self.m.water + 1
        
        if y >= h():
            return above

        for x in range(w()):
            t = num(x, y)
            if self.walkable(t):
                above.add(t)
        return above
Exemplo n.º 8
0
 def get_all_lambdas(self):
     list_lambdas = set()
     for i in range(h() * w()):
         if self.v.get(i) == TileType.LAMBDA:
             list_lambdas.add(tup(i))
     return list_lambdas
Exemplo n.º 9
0
 def get_all_lambdas(self):
     list_lambdas = set()
     for i in range(h() * w()):
         if self.v.get(i) == TT.LAMBDA:
             list_lambdas.add(tup(i))
     return list_lambdas