Add a few questions...
[vchess.git] / public / javascripts / base_rules.js
index 7f4052a..1630495 100644 (file)
@@ -268,8 +268,7 @@ class ChessRules
                {
                        var i = x + step[0];
                        var j = y + step[1];
-                       while (i>=0 && i<sizeX && j>=0 && j<sizeY
-                               && this.board[i][j] == VariantRules.EMPTY)
+                       while (i>=0 && i<sizeX && j>=0 && j<sizeY && this.board[i][j] == VariantRules.EMPTY)
                        {
                                moves.push(this.getBasicMove(x, y, i, j));
                                if (oneStep !== undefined)
@@ -712,7 +711,7 @@ class ChessRules
                VariantRules.PlayOnBoard(this.board, move);
        }
 
-       undo(move, ingame)
+       undo(move)
        {
                VariantRules.UndoOnBoard(this.board, move);
                this.epSquares.pop();
@@ -1037,14 +1036,15 @@ class ChessRules
        }
 
        // The score is already computed when calling this function
-       getPGN(mycolor, score, fenStart)
+       getPGN(mycolor, score, fenStart, mode)
        {
                let pgn = "";
                pgn += '[Site "vchess.club"]<br>';
                const d = new Date();
-               pgn += '[Date "' + d.getFullYear() + '-' + d.getMonth() + '-' + d.getDate() + '"]<br>';
-               pgn += '[White "' + (mycolor=='w'?'Myself':'Anonymous') + '"]<br>';
-               pgn += '[Black "' + (mycolor=='b'?'Myself':'Anonymous') + '"]<br>';
+               const opponent = this.mode=="human" ? "Anonymous" : "Computer";
+               pgn += '[Date "' + d.getFullYear() + '-' + (d.getMonth()+1) + '-' + d.getDate() + '"]<br>';
+               pgn += '[White "' + (mycolor=='w'?'Myself':opponent) + '"]<br>';
+               pgn += '[Black "' + (mycolor=='b'?'Myself':opponent) + '"]<br>';
                pgn += '[Fen "' + fenStart + '"]<br>';
                pgn += '[Result "' + score + '"]<br><br>';