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

I need help with return to thornbush pls help!

def maybeBuildTrap(x, y):
# Use x and y as the coordinates to move to.
hero.moveXY(x, y)
enemy = hero.findNearestEnemy()
if enemy:
pass
# Use buildXY to build a “fire-trap” at the given x and y.
hero.buildXY(“fire-trap”, 43, 50)
hero.buildXY(“fire-trap”, 25, 34)
hero.buildXY(“fire-trap”, 43, 20)
while True:
# This calls maybeBuildTrap, with the coordinates of the top entrance.
maybeBuildTrap(43, 50)

# Now use maybeBuildTrap at the left entrance!
maybeBuildTrap(25, 34)
# Now use maybeBuildTrap at the bottom entrance!
maybeBuildTrap(43, 20)

Hi, welcome to the CodeCombat discourse.
The problem is in the maybeBuildTrap(x, y): function.

You should be building at the “given x and y” not coordinates you already know.
If you look at the while true loop it uses all the coordinates which you use in your three functions. So instead of putting them in both, just put one buildXY() in the function and use the x and y that you used in the:

at the top of the function.
I hope this helps.
-Danny