generalsenv.py 文件源码

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

项目:generals_a3c 作者: yilundu 项目源码 文件源码
def _parse_action(self, action):
        move_type, y, x = np.unravel_index(action, (8, self.map_height, self.map_width))
        start = y * self.map_width + x
        index = move_type % 4

        if index == 0:
            end = start + self.map_width
        elif index == 1:
            end = start + 1
        elif index == 2:
            end = start - self.map_width
        elif index == 3:
            end = start - 1
        else:
            raise("invalid index")

        is_50 = True if move_type >= 4 else False

        return {'start': start, 'end': end, 'is50': is_50}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号