X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=app.js;h=bb1653789337d5e8f4cb8a2e280eea2b71d3d6e7;hb=a2bb7e0621f143f912ca505fed914fe0a5e6d611;hp=c0c74c0a247a2d8a524b9d37b2a4a9cd44a05616;hpb=535c464b0543306a0ea36c66f07dcfad7a951efc;p=xogo.git diff --git a/app.js b/app.js index c0c74c0..bb16537 100644 --- a/app.js +++ b/app.js @@ -454,10 +454,10 @@ function notifyMe(code) { let curMoves = [], lastFen; -const afterPlay = (move) => { +const afterPlay = (move_s) => { const callbackAfterSend = () => { curMoves = []; - const result = vr.getCurrentScore(move); + const result = vr.getCurrentScore(move_s); if (result != "*") { setTimeout(() => { toggleVisible("gameStopped"); @@ -466,7 +466,12 @@ const afterPlay = (move) => { } }; // Pack into one moves array, then send - curMoves.push(move); + if (Array.isArray(move_s)) + // Array of simple moves (e.g. Chakart) + Array.prototype.push.apply(curMoves, move_s); + else + // Usual case + curMoves.push(move_s); if (vr.turn != playerColor) { toggleTurnIndicator(false); send("newmove", @@ -516,7 +521,7 @@ function initializeGame(obj) { -
`; +
`; vr = new V({ seed: obj.seed, //may be null if FEN already exists (running game) fen: obj.fen,