manager.py 文件源码

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

项目:robot-arena 作者: kenganong 项目源码 文件源码
def record_moves_for_robots(state, debug_robots, interactive):
  import roborally.api as api
  for cell, pos in state.board.traverse():
    if cell.content and cell.content[TYPE] == ROBOT:
      robot = cell.content
      api.SIGHT = get_robot_sight(state, pos, robot)
      try:
        robot['move'] = robot['brain'].ai.move()
      except Exception as error:
        if debug_robots:
          if debug_robots == 'interactive':
            import pdb
            pdb.set_trace()
          raise error
        robot[LIFE] -= 1
        if robot[LIFE] == 0:
          record_death(robot, 'overheating', interactive)
        robot['move'] = LASER
      if robot['move'] not in MOVES:
        robot['move'] = LASER
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号