dist-esnext/Move.js
function getGameBeforeLastMove(game) {
    // $Fix I do NOT know if it is the best way to make game immutable.
    game = Object.assign({}, game);
    let lastMove = game.moves.pop();
    if (lastMove)
        game = getGameAfterMove(game, getBackMove(lastMove), true);
    if (Game.getPlayerTurn(game).isAi) {
        lastMove = game.moves.pop();
        if (lastMove) {
            game = getGameAfterMove(game, getBackMove(lastMove), true);
        }
    }
    return game;
}
function getGameBeforeLastMove(game) {
    // $Fix I do NOT know if it is the best way to make game immutable.
    game = Object.assign({}, game);
    let lastMove = game.moves.pop();
    if (lastMove)
        game = getGameAfterMove(game, getBackMove(lastMove), true);
    if (Game.getPlayerTurn(game).isAi) {
        lastMove = game.moves.pop();
        if (lastMove) {
            game = getGameAfterMove(game, getBackMove(lastMove), true);
        }
    }
    return game;
}
function getGameBeforeLastMove ( game ) { // $Fix I do NOT know if it is the best way to make game immutable. game = Object . assign ( { } , game ) ; let lastMove = game . moves . pop ( ) ; if ( lastMove ) game = getGameAfterMove ( game , getBackMove ( lastMove ) , true ) ; if ( Game . getPlayerTurn ( game ) . isAi ) { lastMove = game . moves . pop ( ) ; if ( lastMove ) { game = getGameAfterMove ( game , getBackMove ( lastMove ) , true ) ; } } return game ; }
Get game before last move,
if playing vs Ai rollback Ai move too.
Get game before last move if playing vs Ai rollback Ai move too .