求助,山峰34关怎么过,自己的代码,csdn的代码都过不了
codecombat吧
全部回复
仅看楼主
level 2
LeonDoMain 楼主
求助,山峰34关怎么过,自己的代码,csdn的代码都过不了
2017年10月10日 03点10分 1
level 2
LeonDoMain 楼主
有人嘛
2017年10月10日 03点10分 2
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分
level 4
不攻击就赢了
2018年02月23日 15点02分 5
level 4
士兵去自杀,弓箭手输出
2018年02月23日 15点02分 6
level 4
木材守卫用move鞋捡金币就好了
2018年02月23日 15点02分 7
level 4
2018年02月23日 15点02分 8
1