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