Okay, so I do everything but 1 task. I don’t defeat an orge. Other than that, my code works. What is wrong with it?
Code
# Enemies are sleeping. It's the perfect time for sabotage!
points = [{"x": 21, "y": 8}, {"x": 33, "y": 8},
{"x": 45, "y": 8}, {"x": 57, "y": 8}, {"x": 68, "y": 8},
{"x": 68, "y": 18}, {"x": 68, "y": 28},
{"x": 68, "y": 38}, {"x": 68, "y": 48},
{"x": 68, "y": 58}, {"x": 56, "y": 58},
{"x": 44, "y": 58}, {"x": 32, "y": 58},
{"x": 20, "y": 58}, {"x": 10, "y": 60}]
pointIndex = 0;
while pointIndex < len(points):
point = points[pointIndex];
hero.moveXY(point["x"], point["y"])
enemy = hero.findNearestEnemy()
coin = hero.findNearestItem()
# Attack only if the enemy.team is "ogres"
# AND the enemy's health is less than 10
if enemy.type == "orge" and enemy.health < 15:
hero.attack(enemy)
# Collect a coin if coin.value is less than 5
# AND its distance is less than 7
if coin.value < 7:
hero.move(coin.pos)
# Attack only if the enemy.health is less than 10
# AND the enemy's type is "skeleton".
if enemy.type == "skeleton" and enemy.health < 10:
hero.attack(enemy)
pointIndex += 1