# HELP stuck on volcano fighters

Hi! can you show us your code with formatting?

1 Like

I mean, can you copy and paste your code here?

# This function finds the left-most unit.

def findMostLeft(units):
if len(units) == 0:
return None
mostLeft = units[0]
for unit in units:
if unit.pos.x < mostLeft.pos.x:
mostLeft = unit
return mostLeft

# This function finds the bottom-most unit:

def findMostBottom(units):
if len(units) == 0:
return None
mostBottom = units[0]
for unit in units:
if unit.pos.y < mostBottom.pos.y:
mostBottom = unit
return mostBottom

# Find the top left paladin with findMostLeft function:

def findTopLeft(units):
if len(units) == 0:
return None
mostTop = units[0]
units = findMostLeft(units)
for unit in units:
if unit.pos.y > mostTop.pos.y:
mostTop = unit
topLeft = mostTop

# Find the bottom right paladin with findMostBottom function:

def findBottomRight(units):
if len(units) == 0:
return None
mostRight = units[0]
findMostBottom(units)
for unit in units:
if unit.pos.x > mostRight.pos.x:
mostRight = unit
bottomRight = mostRight
return bottomRight

at the beginning of your code, type ```

1 Like

And can you show a screenshot of your error?

1 Like

wrong one

hello you there?

Yea, iâ€™m there. i donâ€™t exactly know what the set thing is thoughâ€¦

here is my code.
tried that didnâ€™t work for some reason iâ€™ll try again
OH!! got it

I mean, can you paste it (not a picture, like your third post) except properly formatted by putting a ``` in front of your code. the screenshots are a bit blurry

no, not quotation marks: back quotation marks. theyâ€™re at the top left corner of the keyboard, above the tab button

``````    if len(units) == 0:
return None
mostLeft = units[0]
for unit in units:
if unit.pos.x < mostLeft.pos.x:
mostLeft = unit
return mostLeft

# This function finds the bottom-most unit:
def findMostBottom(units):
if len(units) == 0:
return None
mostBottom = units[0]
for unit in units:
if unit.pos.y < mostBottom.pos.y:
mostBottom = unit
return mostBottom

# Find the top left paladin with findMostLeft function:
# Find the bottom right paladin with findMostBottom function:

# Use X coordinate from the top left paladin:
# and Y coordinate from the bottom right paladin:
x = mostLeft.pos.x
y = mostBottom.pos.y
# Move to the {X, Y} point from the previous step:
hero.move({x, y})
# Continue to shield while the volcano is erupting:
while True:
hero.shield()``````
1 Like

I think this should be

``paladins = hero.findByType("paladin")[0]``

it did noooooooooooooooooottttttttttttttttttt wwwwwwwwwwwwwwwwooooooorrrrrrrrrrrrrk!!!
in short: it did not work!!!

hello?

I canâ€™t help for I have never even seen this level in my life, but good job getting the formatting right! thatâ€™s what they want around here to make it easier.

1 Like

this should be `hero.moveXY(x,y)`

ok

is any body there realy do want to compleat this level
oh hi ok

ok sorry

Please be patient. Some people are in school. and others have stuff to do

1 Like