1
2
def encounter(monster_health, monster_damage, my_health, my_damage, distance):
# YOUR CODE HERE
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Powered by

Suppose I encounter a monster.

I have the option to melee attack, or range attack, or flee.

If my damage is higher than or equal to the monster’s damage, and my health is higher than 50, and I'm within distance 50 -> return "Melee Attack"

If my damage is higher than or equal to the monster’s damage, and my health is higher than 50, but I'm not within distance 50 -> return "Range Attack"

Otherwise, I'm too weak -> return "Flee"

Use the following variables:

monster_health

monster_damage

my_health

my_damage

distance

Run your code first!

It looks like you haven't tried running your new code.

Try clicking  Run and if you like the result, try sharing again.

×