[SOLVED] Danger Picklock

# You need to break the door.

# The function checks the equality with 5% inaccuracy.
def almostEqual(a, b):
    return Math.abs(a - b) < (b * 0.05)

# We have a bomb for the door, but it's weak.
bomb = hero.findByType("robobomb")[0]
# Wizards can charge the bomb.
wizards = hero.findByType("wizard")
# The area of a circle should be equal:
chargeArea = bomb.chargeArea
while True:
    # Circle radius:
    radius = bomb.distanceTo(wizards[0])
    # Find the current area of the circle.
    area = radius * radius * Math.PI
    # If it's almost equal to chargeArea:
    

please help me i donโ€™t know how to place the almostEqual

area needs to be almostEqual to chargeArea
~ Orb

what do you mean(20chars)

I mean the area you just defined should be almost equal to the charge area defined above
~ Orb

like this
area = almostEqual * chargeArea * Math.PI

No, no
if almostEqual(area, chargeArea), then you tell the wizards that the bomb is charged enough.
~ Orb

4 Likes

Thank you that worked :smile: :smile:

(/โ—•ใƒฎโ—•)/ (/โ—•ใƒฎโ—•)/ (/โ—•ใƒฎโ—•)/ (/โ—•ใƒฎโ—•)/ (/โ—•ใƒฎโ—•)/ (/โ—•ใƒฎโ—•)/ (/โ—•ใƒฎโ—•)/ (/โ—•ใƒฎโ—•)/ (/โ—•ใƒฎโ—•)/ (/โ—•ใƒฎโ—•)/ (/โ—•ใƒฎโ—•)/
~ Orb

thank you so much iโ€™m now level 38

4 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.