I have a problem with Greed Traps level. I think that the code is OK (correct me if I’m wrong). The point being I collect the coin because it is direcly placed on the way to the designated coordinates. Is it a bug?
#Patrol and place traps ONLY if you see a coin. # Write this function. def maybeBuildTrap(x, y): # Move to the given x,y postion hero.moveXY(x, y) # Search a coin and if you see it, build a "fire-trap" item = hero.findNearestItem() if item: hero.buildXY("fire-trap", x, y) pass while True: # Call maybeBuildTrap for the top left passage. maybeBuildTrap(12, 56) # Now for the top right passage. maybeBuildTrap(67, 56) # Now for the bottom right passage. maybeBuildTrap(67, 12) # Now for the bottom left passage. maybeBuildTrap(12, 12)