@hanabi-live/game
    Preparing search index...

    Function filterCardPossibilities

    • Returns the identities that our card can have while every card in deckPossibilities has one of its own possibilities, without using more copies of an identity than exist.

      This is a bipartite matching between cards and card copies, so it is solved with augmenting paths in polynomial time. (Backtracking over every combination is exponential when there is no valid combination, which froze games with many unknown clued cards, such as Throw It in a Hole.) The matching of the deck is made once. Then our card can have an identity if a copy of it is free, or if the card that uses a copy can move to another identity.

      Parameters

      • cardPossibilities: readonly SuitRankTuple[]
      • deckPossibilities: readonly (readonly SuitRankTuple[])[]
      • cardCountMap: readonly number[][]

      Returns readonly SuitRankTuple[]