38 Kithguard Dungeon has no solution (and what are "arguments"?)


#1

Update: Where my code is
enemy1 = “chunky” # enemy1 now stores "chunky"
enemy1 = hero.findNearestEnemy(“chunky”)
enemy1 = “chunky” # enemy1 now stores "chunky"
hero.attack(chunky)
hero.attack(“chunky”)
The enemy1 = hero.findNearestEnemy(“chunky”) part is red X’d with the "FixYourCode: findNearestEnemy takes no arguments. What does that mean?

There is no possible solution.

enemy1 = hero.findNearestEnemy(“chunky”)

Doesn’t work.

Neither does

chunky = hero.findNearestEnemy()
enemy = hero.findNearestEnemy(“chunky”)
enemy = hero.findNearestEnemy(chunky)
or even enemy1 = “chunky” # enemy1 now stores "chunky"
right bellow enemy =

Nothing changes the variable. If it does, then there is no argument. I don’t even know what an argument is when it never works.


#2

First of all, in that level, is there a chunky?


#3

wait, what is the name of the level?


#4

It is called “By Any Other Name”. Maybe a previous level has the answer?


#5

Don’t make this too difficult. :slight_smile: The original code is this.

# Change the names of variables to make gems appear!
# Change the name of variable "enemy1" to "chunky".
enemy1 = hero.findNearestEnemy()
hero.attack(enemy1)
hero.attack(enemy1)

# Change the name of variable "enemy2" to "monkey".
enemy2 = hero.findNearestEnemy()
hero.attack(enemy2)
hero.attack(enemy2)

# Collect the gems after changing the variables.
hero.moveUp()
hero.moveRight()
hero.moveRight()

It says, “# Change the name of variable “enemy1” to “chunky”.”

So, everywhere it says “enemy1” change it to say “chunky”.

The point of this level is really just to see that the variable names can be whatever you want. It would work fine for killing ogres as written. Bonus gems show up when you change the variable names,

For your other question. An argument is just the stuff you are passing into a function. For example in the line:

hero.attack(enemy2)

the argument is enemy2, it is the stuff inside the parenthesis.


#6

Thank you. I just went to an earlier level to check on argument. Didn’t realize “enemy1” was already changed from the previous code line.