This package includes a converter and previewer, written in node.js.
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
.
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 .
.
The supported notations are:
5dpgn
: the format described in README.mdjson
: 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 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"
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
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
andwrite
functions in theindex.js
file (might make this step optional) - Write your parser in the
parse
function; it should create aGame
instance, parse the notation, do changes to theGame
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 toGame::castle(...)
- Write the stringifier in the
write
function; it should return a string that can be parsed back with yourparse
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.