X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FMarseille.js;h=7d83bd556b1b168a3bf56637859fff0c2d280d5f;hb=b955c65b942d09d24b5c3bed0d755d4f2f8f71f1;hp=d38d177f8707d49cd33bfdbbc261cb7cfe51a930;hpb=7d9e99bc177972c5af8b1b45f4bfb043d8306f30;p=vchess.git diff --git a/public/javascripts/variants/Marseille.js b/public/javascripts/variants/Marseille.js index d38d177f..7d83bd55 100644 --- a/public/javascripts/variants/Marseille.js +++ b/public/javascripts/variants/Marseille.js @@ -292,61 +292,4 @@ class MarseilleRules extends ChessRules return selected[0]; return selected; } - - // TODO: put this generic version elsewhere - getPGN(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'; - 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 += '[FenStart "' + fenStart + '"]\n'; - pgn += '[Fen "' + this.getFen() + '"]\n'; - pgn += '[Result "' + score + '"]\n\n'; - - let counter = 1; - let i = 0; - while (i < this.moves.length) - { - pgn += (counter++) + "."; - for (let color of ["w","b"]) - { - let move = ""; - while (i < this.moves.length && this.moves[i].color == color) - move += this.moves[i++].notation[0] + ","; - move = move.slice(0,-1); //remove last comma - pgn += move + (i < this.moves.length-1 ? " " : ""); - } - } - pgn += "\n\n"; - - // "Complete moves" PGN (helping in ambiguous cases) - counter = 1; - i = 0; - while (i < this.moves.length) - { - pgn += (counter++) + "."; - for (let color of ["w","b"]) - { - let move = ""; - while (i < this.moves.length && this.moves[i].color == color) - move += this.moves[i++].notation[1] + ","; - move = move.slice(0,-1); //remove last comma - pgn += move + (i < this.moves.length-1 ? " " : ""); - } - } - - return pgn + "\n"; - } } - -const VariantRules = MarseilleRules;