level 1
试试我过的。。。
# 食人魔巫师为您准备了一坨惊喜。
# 定义一个 chooseTarget 函数,让它接受friend 参数输入
# 返回要攻击的目标,根据士兵的类型。
# 士兵应该攻击巫师,弓箭手应该攻击最近的敌人。
def chooseTarget(friend):
target = None
if friend.type == "archer":
target = friend.findNearestEnemy()
else:
target = friend.findNearest(hero.findByType("witch", hero.findEnemies()))
return target
while True:
friends = hero.findFriends()
for friend in friends:
# 用你的 chooseTarget 函数决定要攻击什么。
target = chooseTarget(friend)
if target:
hero.command(friend, "attack", target)
pass
2017年11月12日 13点11分
4
请教大神木材守卫怎么过,“让士兵向右移动”这句写不出来
2018年02月14日 00点02分