X-Git-Url: https://git.auder.net/pieces/Checkered/cp.svg?a=blobdiff_plain;f=public%2Fjavascripts%2Fbase_rules.js;h=b44d085623e9b1d8f4ab427bdceabafd1589c7d3;hb=c794dbb87592782913af0a09784ed25e019e4d10;hp=5763af7e1d0f86e40789ff7c9467ce66a3bd1334;hpb=7931e479adf93c87771ded1892a0873af72ae46d;p=vchess.git
diff --git a/public/javascripts/base_rules.js b/public/javascripts/base_rules.js
index 5763af7e..b44d0856 100644
--- a/public/javascripts/base_rules.js
+++ b/public/javascripts/base_rules.js
@@ -50,7 +50,7 @@ class ChessRules
/////////////////
// INITIALIZATION
- // fen == "position flags"
+ // fen == "position [flags [turn]]"
constructor(fen, moves)
{
this.moves = moves;
@@ -1107,7 +1107,7 @@ class ChessRules
return pieces["b"].join("") +
"/pppppppp/8/8/8/8/PPPPPPPP/" +
pieces["w"].join("").toUpperCase() +
- " 1111"; //add flags
+ " 1111 w"; //add flags + turn
}
// Return current fen according to pieces+colors state
@@ -1209,14 +1209,11 @@ class ChessRules
// The score is already computed when calling this function
getPGN(mycolor, score, fenStart, mode)
{
- const zeroPad = x => { return (x<10 ? "0" : "") + x; };
let pgn = "";
pgn += '[Site "vchess.club"]
';
- const d = new Date();
const opponent = mode=="human" ? "Anonymous" : "Computer";
pgn += '[Variant "' + variant + '"]
';
- pgn += '[Date "' + d.getFullYear() + '-' + (d.getMonth()+1) +
- '-' + zeroPad(d.getDate()) + '"]
';
+ pgn += '[Date "' + getDate(new Date()) + '"]
';
pgn += '[White "' + (mycolor=='w'?'Myself':opponent) + '"]
';
pgn += '[Black "' + (mycolor=='b'?'Myself':opponent) + '"]
';
pgn += '[FenStart "' + fenStart + '"]
';