Skip to content

Latest commit

 

History

History
68 lines (44 loc) · 2.64 KB

USAGE.md

File metadata and controls

68 lines (44 loc) · 2.64 KB

5dchess-notation's built-in converter

This package includes a converter and previewer, written in node.js.

Installation

Clone this repository and install its dependencies:

git clone https://github.com/adri326/5dchess-notation
cd 5dchess-notation
npm i -g

If desired, you can install this package only to the local context by using npm i instead of npm i -g.

Running

If you installed this package globally (i.e. using npm i -g), you can use 5dchess-notation.

On Unix platforms, you can run the index.js file right away.

Alternatively, you can use node ..

Notations

The supported notations are:

  • 5dpgn: the format described in README.md
  • json: the internal format of the parsers, parts of it may be different depending on the language that is being parsed from. No verification is done on import, use at your own risk!
  • axel: Axel's RAN. Supports reading from Axel's AN too.

Axel's notation

Axel's notation does not support (as of writing this) a way of specifying boards. Therefore, if the board that the source file plays on isn't the standard board, is should be specified so using the --board parameter:

5dchess-notation convert axel 5dpgn test/game-2.4xel --board "Standard"

Preview

You can preview the games you transcribe with the preview sub-command:

5dchess-notation preview axel test/game-2.4xel

Be sure to check out the available options that the previewer supports by running:

5dchess-notation preview --help

Implementing your own notation

First of all, please pardon the poor code quality, I am currently working on making this thing prettier.

Each implemented notation resides in the parsers/ directory (might be moved later to notation/). You will need to create your notation's parser's file in that directory. This file should export a parse and a write function. Next up:

  • Hook both the parse and write functions in the index.js file (might make this step optional)
  • Write your parser in the parse function; it should create a Game instance, parse the notation, do changes to the Game instance (see next step) and return it
  • Make your parser parse moves; parsed moves should result in a call to Game::play(...) and parsed castlings should result in a call to Game::castle(...)
  • Write the stringifier in the write function; it should return a string that can be parsed back with your parse function.

For each of these steps, you can find the necessary functions in Game and Move and the necessary conversion matrices in game.js and pgn.js.