Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Cubic Minefield help

It is not a code problem just a math issue I have no clue what this level really wants me to do.

# This function returns the number to the exponent power.
def power(number, exponent):
    total = 1
    # Complete the function. It must return the cube of the base
    
    return total

I am so stumped.

We provide a similar function for multiplication above the empty power function which should guide you into making the power function!

On a side note, shouldn’t power return not just the cube of the base as stated in the comment, but the given exponent of the base?

Sorry, it was the wrong comment (rudiment). Fixed.

1 Like

I’m stuck too. Can you help?

I think it’s better for you to play levels in campaign one by one and learn. Adventurer levels are usually for experienced players.

@Bryukh never mind i solved it… old post

i am stuck at it too. can you help me to pass it?

what is wrong? can you tell me?

Please post your code so we can help :wink:

Sorry, my telepathic abilities are limited. Could you give more information?

1 Like

I have the SAME PROBLEM GETTING PAST THIS LEVEL!
This is my code

def mult(number, times):
    total = 0
    while times > 0:
        total += number
        times -= 1
    return total

# This function returns the number to the exponent power.
def power(number, exponent):
    total = 1
    # Complete the function.
    times -= 1
    return total

# Don't change the following code
# You can find coefficients for the equation on the tower
tower = hero.findFriends()[0]
a = tower.a
b = tower.b
c = tower.c
d = tower.d
x = hero.pos.x

while True:
    # To find the path use a cubic equation
    y = a * power(x, 3) + b * power(x, 2) + c * power(x, 1) + d * power(x, 0)
    hero.moveXY(x, y)
    x = x + 5

The little ducky shows up.

The power() is missing some parts. Take a closer look at the mult() function above. You will want to mimic a lot of the setup, with a minor modification to some words and the math symbol.

To get multiplication you add one number as many times of the other. 5 x 4 = 20
5 + 5 + 5 + 5 = 20

To get exponential power, you don’t add one number by the times of the other, but something else: 2 ^ 4 = 16