Function map

  • Modifies board by replacing every card with f(card), without affecting other state of the game.

    This operation must be able to interleave with other operations, so while a map() is in progress, other operations like look() and flip() should not crash or wait for the map() to finish. But the board must remain observably pairwise consistent for players: if two cards on the board match each other before map() is called, then it must not be possible for any player to observe a board state in which that pair of cards do not match.

    Two interleaving map() operations should not crash or force each other to wait or violate pairwise consistency, but the exact way they must interleave is not specified.

    f must be a pure function from cards to cards: given some legal card c, f(c) should be a legal replacement card which is consistently the same every time f(c) is called for that same c.

    Returns

    the state of the board after the replacement from the perspective of playerId, in the format described in the ps4 handout

    Parameters

    • board: Board

      game board

    • playerId: string

      ID of player applying the map; must be a nonempty string of alphanumeric or underscore characters

    • f: ((card: string) => Promise<string>)

      pure function from cards to cards

        • (card: string): Promise<string>
        • Parameters

          • card: string

          Returns Promise<string>

    Returns Promise<string>

Generated using TypeDoc