This document describes development-related topics of pgn-tactics-generator. pgn-tactics-generator is a python application dedicated to creating chess puzzles/tactics from a pgn file. See readme file for more details.
This script requires the Requests and python-chess
libraries to run, as well as a copy of Stockfish.
Is recommended that you use Python 3 and pip3.
It should work with Python 2.7 and pip (probably you will need to install futures pip install futures
)
To install the requirements use something, like:
pip3 install -r requirements.txt --user
It's recommended that the dependencies are isolated in a virtual environment
The project comes with a simple set of basic tests.
The test can be run with:
python -m unittest
The recommended way to run the test is using pytest
:
pytest
ATTOW, the tests cover:
- investigate() function (running investigate with know arguments and expected result)
- puzzle.is_complete
- .ambiguous() and .move_list() methods of position_list class
The idea is that after introducing some changes to the app, you are able to check if puzzle generation logic stayed untouched (produces the same results as the previous version).
The tests are using example data obtained with positions_for_investigation.py.
The script works in similar fashion as main.py
: It reads PGN file, goes through
the games, finds "interesting" positions and generates tactics puzzles.
Some intermediate data (for example the puzzle definitions) are recorded and
writen to json files.
You don't need to re-run the script (as the project already includes required data), unless you want to modify/extend the tests.