Closed danegraphics closed 4 years ago
In short, I propose that the Variation class have a comment() method that applies to itself, and not to any node.
Turns out this exists but is undocumented.
Hi. Thanks for reporting. This is indeed missing in the documentation, I'll fixed that.
@yo35 - In the documentation, could you also include examples of usage? Something that covers a lot more of the API, like the following:
//get the first (or only game) of the pgn
var databaseOfGames = kokopu.pgnRead(pgn);
var firstGame = databaseOfGames.game(0);
//get the variation
var variation = game.mainVariation();
//get the first ply of the variation
var node = variation.first();
//get the comment of the first ply
var comment = node.comment();```
Tutorials added in documentation as of version 1.3.1.
Often in PGN you'll find comments before the first move to describe the game. And in variations on a move, you'll see a comment before the first move of the variation that describes the whole variation, and not the move specifically.
For example:
{Let's look at some openings} 1. e4 e5 {A classic move} ({Here's the Sicilian instead} 1... c5 {This move attacks d4, taking control of the center})
Both "Let's look at some openings" and "Here's the Sicilian instead" get dropped by pgnRead()