0.1.6 • Published 10 years ago

polyglot-chess v0.1.6

Weekly downloads
3
License
-
Repository
github
Last release
10 years ago

Polyglot

Polyglot is a node module to search moves in polyglot format opening books.

Installation

Make sure you have node.js installed. Then do:

$ npm install polyglot

Example

var Polyglot = require('polyglot').Polyglot;

var obj = new Polyglot();

var fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
console.log("Polyglot hash for fen " + fen + " is: " + obj.hash(fen));
console.log("Best move in the book is: " + obj.find(fen, "book.bin", true));
console.log("Random move in the book is: " + obj.find(fen, "book.bin", false));

API

Functions

Polyglot exposes following functions -

find(fen, bookFile, findBest)

find takes a book file path and a polyglot format hash and looks up the hash in the book file. If findBest is true it returns the best move according to the weight otherwise it returns a random move with the given hash.

hash(fen)

hash takes a fen string and returns its polyglot hash.

Contributing

Fork, pick an issue to fix from issues or add a missing feature and send a pull request.

Credits

This work is derivative of the excellent stockfish polyglot book source code.

License

Polyglot is released under the MIT License. See the bundled LICENSE file for details.

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago