X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fbase_rules.js;h=9f6ec9ecbb2b2e7ff3d197422d37462cb50cb9a7;hb=b955c65b942d09d24b5c3bed0d755d4f2f8f71f1;hp=4b0b470521bac7b394d8234386bae0bd3100f31c;hpb=baba60703f661aab20f2327098c3a0af572f0704;p=vchess.git diff --git a/public/javascripts/base_rules.js b/public/javascripts/base_rules.js index 4b0b4705..9f6ec9ec 100644 --- a/public/javascripts/base_rules.js +++ b/public/javascripts/base_rules.js @@ -1053,6 +1053,8 @@ class ChessRules move.flags = JSON.stringify(this.aggregateFlags()); //save flags (for undo) if (V.HasEnpassant) this.epSquares.push( this.getEpSquare(move) ); + if (!move.color) + move.color = this.turn; //for interface V.PlayOnBoard(this.board, move); this.turn = V.GetOppCol(this.turn); this.movesCount++; @@ -1314,42 +1316,4 @@ class ChessRules (move.vanish.length > move.appear.length ? "x" : "") + finalSquare; } } - - // Complete the usual notation, may be required for de-ambiguification - getLongNotation(move) - { - // Not encoding move. But short+long is enough - return V.CoordsToSquare(move.start) + V.CoordsToSquare(move.end); - } - - // The score is already computed when calling this function - getPGN(moves, mycolor, score, fenStart, mode) - { - let pgn = ""; - pgn += '[Site "vchess.club"]\n'; - const opponent = mode=="human" ? "Anonymous" : "Computer"; - pgn += '[Variant "' + variant + '"]\n'; - pgn += '[Date "' + getDate(new Date()) + '"]\n'; - // TODO: later when users are a bit less anonymous, use better names - const whiteName = ["human","computer"].includes(mode) - ? (mycolor=='w'?'Myself':opponent) - : "analyze"; - const blackName = ["human","computer"].includes(mode) - ? (mycolor=='b'?'Myself':opponent) - : "analyze"; - pgn += '[White "' + whiteName + '"]\n'; - pgn += '[Black "' + blackName + '"]\n'; - pgn += '[Fen "' + fenStart + '"]\n'; - pgn += '[Result "' + score + '"]\n\n'; - - // Print moves - for (let i=0; i