Wraps the open-source Stockfish chess engine for easy integration into python.
Project description
Stockfish
Implements an easy-to-use Stockfish class to integrates the Stockfish chess engine with Python.
Install
$ pip install stockfish
Ubuntu or Debian
# apt install stockfish
Mac OS
$ brew install stockfish
Features
- set current position
- get best move
- change engine's skill level
- get current engine's parameters
Usage
from stockfish import Stockfish
# you should install the stockfish engine in your operating system globally or specify path to binary file in class constructor
stockfish = Stockfish('/Users/zhelyabuzhsky/Work/stockfish/stockfish-9-64')
# set position by sequence of moves:
stockfish.set_position(['e2e4', 'e7e6'])
# set position by Forsyth–Edwards Notation (FEN):
stockfish.set_fen_position("rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2")
print(stockfish.get_best_move()) # d2d4
print(stockfish.is_move_correct('a2a3')) # True
# get last move info:
print(stockfish.info)
# e.g. 'info depth 2 seldepth 3 multipv 1 score mate -1 nodes 11 nps 5500 tbhits 0 time 2 pv h2g1 h4g3'
# set current engine's skill level:
stockfish.set_skill_level(15)
# get current engine's parameters:
stockfish.get_parameters()
Testing
$ python setup.py test
Security
If you discover any security related issues, please email zhelyabuzhsky@icloud.com instead of using the issue tracker.
Credits
License
MIT License. Please see License File for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stockfish-3.8.0.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for stockfish-3.8.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1c8e32fa92b32cfe77d8907569e1849a572dd135f2733ae23181f15a43de4b3 |
|
MD5 | 7342ba89417086aca9541ea2460c77ed |
|
BLAKE2b-256 | 50ba9a5e2e90fa9a9e7d6bde57563ce8c81a80c59d78f1cc87270c6ffeeb317d |