Hi, @dedreous

I am stuck on Cubic Minefield

I do not know how to complete the function

Any help?

Thanks

You’ll need to show your code, so we can what/where to help.

Sorry, was in a rush, @dedreous

Anyway, here’s the code:

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

Also, a snapshot of my situation:

The arrow is still there - I do not know how to complete the function.

Use the first function, def mult() as a template. def power() should look just like it, except that it handles number^exponent, which means number * number * number (etc, etc), where exponent is how many times to multiply number by itself.

This is what I did:

```
# 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.
while exponent > 0:
total += number
exponent -= 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, 75)
x = x + 5
```

I lost 900 hp but finished the level?:

heh…you should finish with 100% health

In the first function you are adding a number to itself, many times. In the second function, you should MULTIPLY instead.

But it worked and I finished the level.

Creativity or madness and giving up?

It’s one of the two because I put `hero.moveXY(x, 75)`

- which lead to me completing the level and me losing 900hp.

my character just keeps running into the bottom of the map. please help!

Please could you post your code.

Danny