Hi, my name is Samarth and I am 13 years old… I had a doubt in the ‘Mind The Trap’ level in Backwoods Forest…can someone help me ??
My code :
while True:
flag = hero.findFlag()
enemy = hero.findNearestEnemy()
if flag:
# Pick up the flag.
hero.pickUpFlag(flag)
hero.say("I should pick up the flag.")
elif enemy:
# Only attack if the enemy distance is < 10 meters
if hero.distanceTo(enemy) < 10:
hero.attack(enemy)