+
+ // Complete the usual notation, may be required for de-ambiguification
+ getLongNotation(move)
+ {
+ const startSquare =
+ String.fromCharCode(97 + move.start.y) + (V.size.x-move.start.x);
+ const finalSquare = String.fromCharCode(97 + move.end.y) + (V.size.x-move.end.x);
+ return startSquare + finalSquare; //not encoding move. But short+long is enough
+ }
+
+ // The score is already computed when calling this function
+ getPGN(mycolor, score, fenStart, mode)
+ {
+ let pgn = "";
+ pgn += '[Site "vchess.club"]<br>';
+ const opponent = mode=="human" ? "Anonymous" : "Computer";
+ pgn += '[Variant "' + variant + '"]<br>';
+ pgn += '[Date "' + getDate(new Date()) + '"]<br>';
+ pgn += '[White "' + (mycolor=='w'?'Myself':opponent) + '"]<br>';
+ pgn += '[Black "' + (mycolor=='b'?'Myself':opponent) + '"]<br>';
+ pgn += '[FenStart "' + fenStart + '"]<br>';
+ pgn += '[Fen "' + this.getFen() + '"]<br>';
+ pgn += '[Result "' + score + '"]<br><br>';
+
+ // Standard PGN
+ for (let i=0; i<this.moves.length; i++)
+ {
+ if (i % 2 == 0)
+ pgn += ((i/2)+1) + ".";
+ pgn += this.moves[i].notation[0] + " ";
+ }
+ pgn += "<br><br>";
+
+ // "Complete moves" PGN (helping in ambiguous cases)
+ for (let i=0; i<this.moves.length; i++)
+ {
+ if (i % 2 == 0)
+ pgn += ((i/2)+1) + ".";
+ pgn += this.moves[i].notation[1] + " ";
+ }
+
+ return pgn;
+ }