Skip to content

cakiki/chess-puzzler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chess-puzzler

Python package to generate and tag puzzles from chess games.

Installation

From pypi:

pip install chess-puzzler`

From source:

pip install git+https://github.com/cakiki/chess-puzzler.git`

Engine

Finding puzzles and some tagging functions require a UCI-compliant chess engine like Stockfish.

Usage

You can use chess-puzzler as a CLI tool or as a python library:

CLI

puzzler find game.pgn --all --tag

Library

import chess.pgn
from chess_puzzler import Generator, open_engine
from chess_puzzler.tagger import cook

engine = open_engine("stockfish")
game = chess.pgn.read_game(open("game.pgn"))
puzzles = Generator(engine).analyze_game(game, all_puzzles=True)
for puzzle in puzzles:
    puzzle.tags = cook(puzzle, engine=engine)
    print(puzzle.to_dict())
engine.close()

Important

Stockfish is non-deterministic when running multi-threaded. For reproducible results across different runs, make sure to run with threads=1.

Configuration

TODO

Inspiration

This is a refactor of ornicar/lichess-puzzler, also inspired by kraktus/lichess-puzzler and fitztrev/puzzler. The goal was to make the lichess-puzzler more pythonic and pip installable.

License

chess-puzzler is licensed under the GNU Affero General Public License 3 or any later version of your choice.

About

Generate and tag puzzles from chess games

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages