level 1
最后一个enemyDistance不要加引号
人家让你说eD的值,你加引号只会说出eD这个函数名
2017年02月08日 09点02分
3
level 3
# It's an ambush and your only weapon is the old, blind wizard.
# Your task is to tell him the distance to the coming ogres.
# This function finds the nearest enemy and returns the distance to it.
# If there is no enemy, the function returns 0.
def nearestEnemyDistance():
enemy = hero.findNearestEnemy()
result = 0
if enemy:
result = hero.distanceTo(enemy)
return result
while True:
# Call nearestEnemyDistance() and
# save the result in the variable "distance"
distance = nearestEnemyDistance()
# If the variable "distance" is greater than 0:
if distance > 0:
# Say the value of "distance" variable.
hero.say(distance)
2017年02月09日 04点02分
5
level 2
if enemyDistance>0:
hero.say(enemyDistance)
2017年04月14日 08点04分
7