- 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>';
+ pgn += '[Variant "' + variant + '"]\n';
+ pgn += '[Date "' + getDate(new Date()) + '"]\n';
+ // TODO: later when users are a bit less anonymous, use better names
+ 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';