X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=public%2Fjavascripts%2Fvariants%2FMarseille.js;h=7aa73c012da0c5d79bff8693554e5e7a10f9bb7b;hp=d38d177f8707d49cd33bfdbbc261cb7cfe51a930;hb=59d58d7da742c937bca80c2102c2e72cc7d6e840;hpb=7d9e99bc177972c5af8b1b45f4bfb043d8306f30 diff --git a/public/javascripts/variants/Marseille.js b/public/javascripts/variants/Marseille.js index d38d177f..7aa73c01 100644 --- a/public/javascripts/variants/Marseille.js +++ b/public/javascripts/variants/Marseille.js @@ -292,61 +292,6 @@ 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;