Function flip

  • Tries to flip over a card on the board, following the rules in the ps4 handout. If another player controls the card, then this operation blocks until the flip either becomes possible or fails.

    Returns

    the state of the board after the flip, in the format described in the ps4 handout

    Throws

    an error (rejecting the promise) if the flip operation fails as described in the ps4 handout.

    Parameters

    • board: Board

      a Memory Scramble board

    • playerId: string

      ID of player making the flip; must be a nonempty string of alphanumeric or underscore characters

    • row: number

      row number of card to flip; must be an integer in [0, height of board), indexed from the top of the board

    • column: number

      column number of card to flip; must be an integer in [0, width of board), indexed from the left of the board

    Returns Promise<string>

Generated using TypeDoc