def getGameState(self):

        min_dist = 999
        min_block = None
        for b in self.block_group: #Groups do not return in order
            dist_to = b.pos.x - self.player.pos.x
            if dist_to > 0 and dist_to < min_dist:
                min_block = b
                min_dist = dist_to
                
        current_terrain = pygame.sprite.spritecollide(self.player, self.terrain_group, False)[0]
        state = {
            "player_y": self.player.pos.y,
            "player_vel": self.player.momentum,
            "player_dist_to_ceil": self.player.pos.y-(current_terrain.pos.y-self.height*0.25),
            "player_dist_to_floor": (current_terrain.pos.y+self.height*0.25)-self.player.pos.y,
            "next_gate_dist_to_player": min_dist,
            "next_gate_block_top": min_block.pos.y,
            "next_gate_block_bottom": min_block.pos.y+min_block.height
        }

        return state
Clones this Geometry.
dataset/ETHPy150Open ntasfi/PyGame-Learning-Environment/ple/games/pixelcopter.py/Pixelcopter.getGameState--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/contrib/gis/geos/geometry.py/GEOSGeometry.clone