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

I don't know what code to use

I can’t figure out what to put in to beat this level. It is in backwoods forest, level tauntingbnhdoibln genksbnstknnsfjkljnknlshsnj

what level is it
-Zax

Backwoods forest, taunting

is it a free level

  • Zax

yes. it is a free level

will you please format your code correctly please so i can help by doing this:

# my code is formatted correctly
if enemy.type == "munchkin" #change to this

if (enemy) :
        dealEnemy(enemy):
    # You have to call the function and since enemy is hero.findNearestEnemy() it will use this to check enemies

Whenever you have a function you have to call it for it to run.

For example:

def isOgre(enemy): # this can be named whatever but don't worry about this for now
# If enemy.type is "ogre":
    if enemy.type == "ogre":
    # Then attack it:
    hero.attack(enemy):

    else:
    hero.say("move along"):

pass

while True: 
    enemy = hero.findNearestEnemy()
    isOgre(enemy):
` Attack munchkins, call brawlers and ignore burls.

# This function defines the hero’s behaviour about enemies.

def dealEnemy(enemy):
# If enemy.type is “munchkin”:
if enemy.type == “munchkin”:
# Then attack it:
hero.attack(enemy)
# If the enemy’s type is “brawler”:
if enemy.type == “brawler”:
# Then say something to call the brawler:
hero.say(“I dont think so brawler”)
pass

while True:
enemy = hero.findNearestEnemy()
if enemy:
dealEnemy(enemy)
else:
hero.moveXY(30, 34)`

@ZAX155 Change the two parts I showed you.

Read hints???.I think reading the hints will help you or look at the goals . The goals help me.