• This function efficiently evaluates all of an adventurer's possibly reminiscable monsters, placing them through a filtering criteria and evaluating them based on a passed function.

    Parameters

    • criteria: ((monster: Monster) => boolean)

      A filtering function for delineating which monsters are "fair game" for the search, such as "is this monster free".

        • (monster): boolean
        • Parameters

          • monster: Monster

          Returns boolean

    • value: ((monster: Monster) => number) = ...

      A function for deciding which monsters are "better" than others.

        • (monster): number
        • Parameters

          • monster: Monster

          Returns number

    Returns Monster | null

    A singular monster that fulfills the criteria function and maximizes the value function.