corridor.py 文件源码

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

项目:deep-rl-tensorflow 作者: carpedm20 项目源码 文件源码
def _render(self, mode='human', close=False):
    if close:
      return

    outfile = StringIO.StringIO() if mode == 'ansi' else sys.stdout

    row, col = self.s // self.ncol, self.s % self.ncol
    desc = self.desc.tolist()
    desc[row][col] = utils.colorize(desc[row][col], "red", highlight=True)

    outfile.write("\n".join("".join(row) for row in desc)+"\n")
    if self.lastaction is not None:
      outfile.write("  ({})\n".format(self.get_action_meanings()[self.lastaction]))
    else:
      outfile.write("\n")

    return outfile
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号