4
Being a classified monster with your name, attack and defense. ("medusa", 2, 5) or (string, int, int). And getting a list of monsters, how do I create a function that tells me if the monster I want to evaluate is weaker than the ones on the list, using recursiveness? Example:
maisFraco ("medusa", 2, 5) [("Pegasus", 10, 3),("hidra", 3, 6)]. Return true.
maisFraco ("minotauro", 5, 4) [("grifo", 10, 3),("trol", 3, 6)]. Return false
I think I have to go through the list and compare the values of attack and defense, I think it is using the map, and then I compare until both the values of attack and defense are greater than any on the list, so I can stop my function because the monster is not the weakest (condition of stopping). But I don’t know how to grab the offense and the defense and compare in the list recursively.
maisFraco :: (String, Int, Int) -> [(String, Int, Int)] -> Bool
maisFraco =
maisFracoAux :: int -> int -> Bool
maisFracoAux x y= if x > y then true else false
tried with an auxiliary function that compares two values to see if they are larger, but I always have the problem of having to compare two numbers