CodeCombat(极客战记)敏捷的匕首代码-python

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)

猜你喜欢

转载自blog.csdn.net/hqj_email/article/details/81415352