API Docs for: 0.0.2
Show:

chess.pgn.Parser Class

Module: Parser

Model to PGN parser. Takes a chess.model.Game as only argument and returns a PGN string for the game.

Constructor

chess.pgn.Parser

(
  • model
)

Parameters:

Example:

 var game = new chess.model.Game();
 game.setMetadataValue('white','Magnus Carlsen');
 game.setMetadataValue('black','Levon Aronian');
 game.appendMove('e4');
 game.appendMove('e5');

 var parser = new chess.pgn.Parser(game);
 console.log(parser.getPgn());

Methods

getFirstComment

() String private

Return comment before first move

Returns:

getMetadata

() String private

Returns:

getMoves

() String private

Returns:

getMovesInBranch

(
  • moves
  • moveIndex
)
String private

Return main line of moves or a variation

Parameters:

Returns:

getPgn

() String

Return pgn in string format

Returns:

Properties