CodeCombat(极客战记)敏捷的匕首代码-python
CodeCombat地址
https://codecombat.cn/或https://codecombat.163.com/
# 长距离用你的弓,短距离用匕首
while True:
enemy = hero.findNearestEnemy()
if enemy:
distance = hero.distanceTo(enemy)
if distance < hero.throwRange:
# 向敌人扔你的匕首
hero.throw(enemy)
else:
# 用你的弓攻击敌人
hero.attack(enemy)