Ritual of Rectangling - Adventurer Feedback

@John_Lang just taking a quick look try adding a hero.say() here in the code. Ask yourself what the statement will be in each case.

def almostEqual(valueA, valueB):
    if valueA > 0.97 * valueB and valueA < 1.03 * valueB:
        hero.say( valueA == valueB )
        return valueA == valueB
1 Like

I got it. However, the source code is wrong.
ā€¦

# 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,

2 Likes

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ā€¦ :smile:

1 Like

Interestingā€¦ Anyways, thanks!

1 Like

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?

Great level, by the way. I loved it.

1 Like

Hmmm, maybe because of bad graphic designs? Tell @Serg about this.

2 Likes

I wonder if this is an issue with all enlarged thangs because I also see this in The Trials.

1 Like

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!

2 Likes

Maybe you could adjust the z axis in css to raise it higher?

1 Like

Nope, layers are not the same as height. Donā€™t worry, I will fix it

2 Likes