ps4
    Preparing search index...

    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 waits until the flip either becomes possible or fails.

      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>

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

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