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 (e.g. look() should not block while a map() is in progress), but the board must remain observably 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.

    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, 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