mcostalba / chess_db

GNU General Public License v3.0
22 stars 5 forks source link

Create Python API to chess_db #9

Closed gbtami closed 7 years ago

gbtami commented 8 years ago

As mentioned in issue #6 chess_db now is a one purpose tool to read one .pgn file and create one .bin polyglot file on output. I suggest to turn it into a general purpose .pgn parser library with Python API. For example if parser would be able to emit parsed move list data game by game it can help writing .pgn importers for chess databases. This just needs a parser class initialized with .pgn opening an mem mapping stuff and a member function get_next_parsed_game() returning the next game movelist as an array of 2 byte moves. This can be wrapped with ctypes to let it call from Python. See http://stackoverflow.com/questions/145270/calling-c-c-from-python

The output format of get_next_parsed_game() function can be parametrized and offer another formats like (from, to, flags) or long algebraic(UCI) or some one byte encoded move format used by other databases.

mcostalba commented 8 years ago

@gbtami Interesting stuff. I think we need to layout a possible API for this.

Starting from the API, it will be easier to get an idea of the whole picture.

sshivaji commented 7 years ago

There is now a chess_db.py in the parser folder that serves as the python API. I think the issue can be closed.