# 机器人炸弹在被摧毁或触碰敌人时爆炸。
# 分离你的士兵,这样他们就不会一起被炸伤。
while True:
enemies = hero.findEnemies()
enemy = hero.findNearest(enemies)
friends = hero.findFriends()
# 派友军数组的第一个士兵向敌人进攻。
firstF= friends[0]
hero.command(firstF, "attack", enemy)
# i in range(1, n) 在第二个元素启动索引!
for i in range(1, len(friends)):
friend = friends[i]
# 命令剩下的士兵逃跑!
hero.command(friend, "move", {"x":5,"y":17})
数组的运用,for循环的运用 ,range(start(初值),stop(end,终值),scan(步长值))
command的命令使用