Giter Site home page Giter Site logo

polyglot's Introduction

polyglot

This is the open source polyglot chess opening book utility. I could not find this on github anywhere. Changes to support game indexing via leveldb have been added. Fabien Letouzey's original readme is in readme.txt.

New Features: Builds a polyglot book but supports a leveldb position/game index as well. The leveldb option can be enabled with -leveldb

Compile:

  1. Install leveldb library (for mac OS X, brew install leveldb)
  2. Execute make

To build a simple opening book without a game index:

  1. ./polyglot make-book -pgn <pgn_file> -min-game 1

To build a game index:

  1. ./polyglot make-book -pgn <pgn_file> -leveldb <leveldb_dir_name> -min-game 1

Builds a leveldb game number and header index. To access the indexes:

  1. To access the game header index: The "game_<game_number>_data" key contains a pipe (|) separated list of values:

  2. White player name

  3. White player elo

  4. Black player name

  5. Black player elo

  6. result (1-0, 0-1, 1/2-1/2 etc)

  7. Date

  8. Site

  9. ECO

  10. last_stream_position

  11. Start FEN

  12. Most of the fields are self-explanatory, the last_stream_position key contains the fseek position of the game (similar to the byte position of the game) in the PGN file. This is useful when wanting to quickly retrieve that game. To optimize retrieval, look up the last_stream_position of the next game and get all content between the fseeks. Note: The fseek content does not start with the opening "[", one needs to add in an opening "[" after the seek to work with PGN parsers.

  13. Position index: To look up the games referenced by a position:

  14. Compute the polyglot hash for a board position. Look up the position_hash as a key, a list of comma separated values containing game ids will be returned. Note: There will a trailing comma after the last game. The code reading the list of games has to ignore the last comma.

  15. The games are not in any order.

  16. Additional metadata can be accessed via: "total_game_count" contains the total number of games in the pgn file. "pgn_filename" contains the name of the original PGN file.

  17. Additional notes:

  18. The leveldb game indexing is currently done in RAM. Later versions will be done without RAM. Thus, the RAM needed is similar to polyglot's typical RAM needs.

  19. The kivy-chess github project currently uses the leveldb indexes.

polyglot's People

Contributors

sshivaji avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.