soccer_environment.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:pygame-rl 作者: ebola777 项目源码 文件源码
def get_bounds(cls, area):
    """Return the rectangular bounds of the area.

    Args:
      area (list): A list of positions.

    Returns:
      list: [x1, y1, x2, y2] where (x1, y1) is the top-left point and (x2, y2)
      is the bottom-right point.
    """
    x1 = math.inf
    y1 = math.inf
    x2 = (-math.inf)
    y2 = (-math.inf)
    for pos in area:
      if pos[0] < x1:
        x1 = pos[0]
      if pos[1] < y1:
        y1 = pos[1]
      if pos[0] > x2:
        x2 = pos[0]
      if pos[1] > y2:
        y2 = pos[1]
    return [x1, y1, x2, y2]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号