libram
    Preparing search index...

    Function findMonster

    • 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".

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

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

      Returns Monster | null

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