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