Salted earth please help



you need to put something after your “if” statement on line 12.
currently, your code does this in this order :

  • Finds the nearest enemy
  • checks if that nearest enemy is a munchkin or a thrower
  • if it is a munchkin or thrower, attack it
  • finds the nearest item
  • checks if that item is a coin or a gem

Notice how it looks a bit incomplete at the end? You are checking for an item and then doing nothing from there on, you need to follow up your ‘if’ statement on line 12 with something.

(Checks previous levels if you aren’t sure on how to move to an item’s X and Y coordinates)

# Ogres are attacking a nearby settlement!
# Be careful, though, for the ogres have sown the ground with poison.
# Gather coins and defeat the ogres, but avoid the burls and poison!

while True:
    enemy = hero.findNearestEnemy()
    if enemy.type == "munchkin" or enemy.type == "thrower":
    item = hero.findNearestItem()
    # Check the item type to make sure the hero doesn't pick up poison!
    # Look for types: 'gem' and 'coin'
    if item.type == "coin" or item.type == "gem":
        hero.moveXY(item.pos.x, item.pos.y)

is this better?


I’m not sure, is it? What errors are you getting now?


none i beat the level thanks can you help me do cursed wonderglade?

this is what it is doing

while True:
    item = hero.findNearestItem()   
    if item.type != "gem":
        hero.moveXY(item.pos.x, item.pos.y)
    # Find the nearest enemy.
    # Attack it if it exists and its type isn't "burl".
    enemy = hero.findNearestEnemy()
    if enemy.type != "burl":
this is my code


did you mean to put ‘!’?


if item AND item.type != “gem”:


if enemy AND enemy.type != “burl”: