这一关最开始的时候人类士兵的总血量就比兽人多啊 (1800 vs 1080)?
而且开始攻击后,就连一个兽人士兵都杀不死, 如果不是bug的话各位大神能否帮忙看一下是不是我的代码有问题, 谢谢:cold_sweat:
def sumHealth(units):
totalHealth = 0
unitsIndex = 0
while unitsIndex < len(units):
unit = units[unitsIndex]
if unit.health > totalHealth:
totalHealth += unit.health
unitsIndex += 1
return totalHealth
while True:
friends = hero.findFriends()
enemies = hero.findEnemies()
# Get the total health of your soldiers and the ogres.
soldierHealth = sumHealth(friends)
ogreHealth = sumHealth(enemies)
# Say "Attack" when your side has more total health.
if soldierHealth != ogreHealth:
if soldierHealth > ogreHealth:
hero.say("Attack")
pass