# We must summon the Ancient Warrior for this ogre!
# Four paladins must form a rectangle.
# But the rectangle needs a specific area and perimeter
# Paladins will keep moving, say the spell when ready.
# It is hard to be precise, but almost equal is good.
# This function should compare valueA and B within 3%.
def almostEqual(valueA, valueB):
# Check if valueA is > 0.97 and < 1.03 of valueB.
# As a default, just check equality.
return valueA == valueB
# This function should calculate the perimeter:
def perimeter(side1, side2):
# The perimeter is the sum of all four sides.
pass
# This function should return the area:
def area(side1, side2):
# The area of a rectangle is the product of 2 sides
pass
# Required summoning values for area and perimeter:
requiredPerimeter = 104
requiredArea = 660
# We will use this unit as a base for our calculations:
base = hero.findNearest(hero.findFriends())
while True:
sideSN = base.distanceTo("Femae")
sideWE = base.distanceTo("Illumina")
currentPerimeter = perimeter(sideSN, sideWE)
currentArea = area(sideSN, sideWE)
if almostEqual(currentArea, requiredArea) and almostEqual(currentPerimeter, requiredPerimeter):
hero.say("VENITE!")
break
The"return valueA == valueB" needs to be changed to āreturn Trueā.
Thanks,
Heās not wrong, returning an ā==ā value, in a function checking for approximation is returning a False value. Not sure if this was deliberate to catch people sleepingā¦
This doesnāt have anything much to do with the code, but I think I might be experiencing glitches or something.
Before the enemy dies -
Nothing odd-looking so far, butā¦
After the enemy dies -
Then the enemy somehow appears to be underneath the bones on the ground, almost like part of an animated background (in my opinion) when he dies; is this intended?
Itās a āproblemā with layers. All dead bodies get lower layer priority, otherwise they will āhideā other āaliveā objects.
I will think how to solve it for this level. Thanks!