• Given a state aState and a player aPlayer, returns the list of all possible moves for this player from this state.

    Parameters

    • aState: string[]

      a state of the game

    • aPlayer: string

      a player of the game, "o" or "x"

    Returns string[][]

    • an array of states
    stateNexts(['x', 'o', 'x', ' ', ' ', ' ', 'x', 'o', 'x'], 'x');
    // -> [ [ 'x', 'o', 'x', 'x', ' ', ' ', 'x', 'o', 'x' ],
    // [ 'x', 'o', 'x', ' ', 'x', ' ', 'x', 'o', 'x' ],
    // [ 'x', 'o', 'x', ' ', ' ', 'x', 'x', 'o', 'x' ] ]