here is my code, it works but i cannot complete the level because it always runs out of time and i am not sure whats wrong with it.
# Ogres are going to attack soon.
# Move near each of tents (to the X marks)
# say() something at each X to wake your soldiers.
# Beware: leave the camp when the battle begins!
# Ogres will send reinforcements if they see the hero.
# The sergeant knows the distance between tents.
sergeant = hero.findNearest(hero.findFriends())
# The distances between the X marks.
stepX = sergeant.tentDistanceX
stepY = sergeant.tentDistanceY
# The number of tents.
tentsInRow = 5
tentsInColumn = 4
# The first tent mark has constant coordinates.
firstX = 10
firstY = 14
while True :
for x in range(firstX, 61, stepX) :
for y in range(firstY, 78, stepY) :
hero.moveXY(x, y)
hero.say("yay")
hero.moveXY(6,9)
It still doesn’t work for some reason, and I tried putting for y in range(firstY, firstY+stepY*4+1, stepY): for x in range(firstX, firstX+stepX*5+1, stepX): too but it didn’t work for some reason.