Efficiently query large chess game collections
Maintainer(s):
thomas-daniels
Installing and Loading
INSTALL aixchess FROM community;
LOAD aixchess;
About aixchess
Aix enables efficient storage and querying of large chess game collections. A game's moves are encoded in a binary representation, and this extension provides scalar functions to decode and query these games directly within DuckDB.
See the GitHub repository or blog post for more details.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| board_at_position | scalar | Returns the board at a given position as a struct. | NULL | NULL |
| clocks_to_move_times | scalar | Transform clocks (of one player) into move times, given the clock times and increment. | NULL | NULL |
| eval_to_centipawns | scalar | Returns eval if it is a centipawn evaluation, NULL if mate. | NULL | NULL |
| eval_to_mate | scalar | Returns moves to mate if eval is mate, NULL if centipawn evaluation. | NULL | NULL |
| fen_at_position | scalar | Returns the FEN at a given position. | NULL | NULL |
| matches_subfen | scalar | Returns true if any position matches a given sub-FEN. | NULL | NULL |
| move_details | scalar | Returns a list of details for all moves in the game. | NULL | NULL |
| move_details_at | scalar | Returns the details of a given move in the game. | NULL | NULL |
| moved_pieces | scalar | Returns the moved pieces in order as a string. | NULL | NULL |
| moved_pieces_list | scalar | Returns the moved pieces in order as a list. | NULL | NULL |
| piece_counts_at_position | scalar | Returns the piece counts at a given position. | NULL | NULL |
| pieces_at_position | scalar | Returns the squares where the pieces are at a given position. | NULL | NULL |
| recompress | scalar | Recompresses a game at a given compression level. | NULL | NULL |
| scoutfish_query | scalar | Returns true if a game matches a Scoutfish query. | NULL | NULL |
| scoutfish_query_plies | scalar | Returns the list of plies matching a Scoutfish query. | NULL | NULL |
| time_control_lichess | scalar | Returns the Lichess time control name for given initial time and increment. | NULL | NULL |
| to_pgn | scalar | Represents the game as a PGN string. | NULL | NULL |
| to_uci | scalar | Represents the game as a UCI string. | NULL | NULL |
| winning_chances_lichess | scalar | Converts an evaluation to winning chances using the Lichess formula. | NULL | NULL |
| list_eval_to_centipawns | macro | Apply eval_to_centipawns to all items in a list. | NULL | NULL |
| list_eval_to_mate | macro | Apply eval_to_mate to all items in a list. | NULL | NULL |
| list_winning_chances_lichess | macro | Apply winning_chances_lichess to all items in a list. | NULL | NULL |
| clocks_to_move_times__check_nulls | scalar | NULL | NULL | NULL |