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}
评论列表
文章目录