コード例 #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
コード例 #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
コード例 #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
コード例 #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
コード例 #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
     )
コード例 #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
コード例 #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
コード例 #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
コード例 #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