Yes, unfortunately I have not finished it.
Lydia
# Collect 4 gems. Don't touch gems from the inner circle.
# The radius of the gem-trap circle.
innerRadius = hero.distanceTo(hero.findNearestItem())
# This function check that a is definitely greater than b.
def definitelyGreater(a, b):
return a > b + 0.5
gems = hero.findItems()
# Iterate all gems:
for gem in gems:
# Use definitelyGreater to check if a gem's distance
# is greater than the inner radius:
if (definitelyGreater(a, b)) > innerRadius:
hero.move(gem.pos)
hero.moveXY(40, 34)
@Destroyer5023 try putting this:centre = {"x": 40, "y": 34}
above gems = hero.findItems()
Mumbo_6
1 Like
and your entire if-statement needs to be replaced with this:
if definitelyGreater(hero.distanceTo(gem), innerRadius):
hero.moveXY(gem.pos.x, gem.pos.y)
hero.moveXY(centre.x, centre.y)
3 Likes
thank you so much i was stuck on it for so long
2 Likes
No problem at all! And for beating the level
2 Likes
This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.