Skip to content

Commit

Permalink
Update readme and requirements.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
vitogit committed Mar 13, 2020
1 parent 7113e9a commit e737962
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 26 deletions.
34 changes: 9 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ It uses a different approach to create tactics, so probably it will generate a d
## Installation

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. But it could work with Python 2.7 and pip (probably you will need to install futures `pip install futures` )

### Install Requests
### Install requirements

`pip install requests`

### Install Python Chess

`pip install python-chess`
`pip3 install -r requirements.txt --user`

### Setup

Expand All @@ -39,15 +36,15 @@ MacOS / Linux : `sh build-stockfish.sh` to obtain the current lichess Stockfish
## Launching Application
First you can download your games from lichess with

`python download_games.py <lichess username>`
`python3 download_games.py <lichess username>`

This will download the last 60 games from blitz,rapid and classical. You can add some params like max number of games and the lichess api token that make the download faster. https://lichess.org/api#operation/apiGamesUser

`python download_games.py <lichess username> --max 100 --token 123456789`
`python3 download_games.py <lichess username> --max 100 --token 123456789`


Then execute the generator (it will look for a file called games.pgn)
`python main.py --quiet`
`python3 main.py --quiet`

You can also use parameters

Expand All @@ -56,31 +53,18 @@ You can also use parameters
- --games=ruy_lopez.pgn to select a specific pgn file. Default is `games.pgn`
- strict=False . False to generate more tactics but a little more ambiguous. Default is `True`
- Threads and Hash defaults to 4 and 2048
`python main.py --quiet --depth=18 --games=ruy_lopez.pgn --strict=True <#Threads = 4> <Hash (MBytes) = 2048>`

Example:
`python3 main.py --quiet --depth=18 --games=ruy_lopez.pgn --strict=True <#Threads = 4> <Hash (MBytes) = 2048>`

## Tactics output

The resulting file will be a pgn file called tactics.pgn. Each tactic contains the headers from the source game. The result header it's the tactic result and not the game result. It can be loaded to a lichess study or to an app like ichess to practice tactics.
The resulting file will be a pgn file called tactics.pgn. Each tactic contains the headers from the source game. The result header it's the tactic result and not the game result. It can be loaded to a Lichess study or to an app like iChess to practice tactics.

## Problems?

#### Python 2.7
- For Python 2.7 install futures `pip install futures`

#### Python 3
If you have problems with pip maybe it's because your system use a separate version like pip3.
Or maybe you should execute the scripts with python3 instead of python if you have that installed.
Like:

`python3 download_games.py <lichess username> <Secret API Token>`

`python3 main.py <Secret API Token> <#Threads = 4> <Hash (MBytes) = 2048>`

#### Stockfish errors
- If you have problems building stockfish try downloading stockfish directly https://stockfishchess.org/download/


## Want to see all my chess related projects?
Check [My projects](http://vitomd.com/blog/projects/) for a full detailed list.

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
colorama==0.3.7
python-chess==0.15.0
python-chess==0.24.2
requests==2.20.0

0 comments on commit e737962

Please sign in to comment.