Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Cubic Minefield help needed


I honestly have no idea what to put on line 15 please explain.

# Walk through the minefield

# This function returns the number multiplied by the times
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.
    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 second function, line 12, follows the same structure as the function above it. Look at the first function, then see if you can do the same thing from line 15 but with the correct variables. After you’ve done this there should only be one thing left to do. If you haven’t already, look at the hints; they should help you find the last thing. Hope this helps.


I still have absolutely no idea…


Make the second function exactly like the first, only instead of using the argument, times, substitute the argument, exponent.


It didn’t work, but I came up with another way


I defeated the level with simple "moveXY"s!


Hi, thanks for sharing your knowledge, but in the future could you not post on old topics.
f you need help you can make a new topic; it stops this old topic being pushed back to the top of the recent list, confusing people and making everything messy.
:lion: :lion: :lion:


Actually I’m fine with necroposts. As long as they’re relevant to the topic and doesn’t go against the guidelines, I think it’s better than having new topics. It’s in my opinion, less messier than more topics.


Normally you say it isn’t, but that’s still my opinion.


Guess I learned what I did wrong. :frowning_face: