Skip to main content

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


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.6.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stockfish-3.6.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file stockfish-3.6.0.tar.gz.

File metadata

  • Download URL: stockfish-3.6.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for stockfish-3.6.0.tar.gz
Algorithm Hash digest
SHA256 988273adac7cad4edccbaeea5d91c52652a975261abbef61bf5777db1898d089
MD5 1617060787c1b9ceb44b828e00e5aff7
BLAKE2b-256 4926d95080975e40071f1f07ae568cf849b59eab275c305545ac851c3260c23b

See more details on using hashes here.

File details

Details for the file stockfish-3.6.0-py3-none-any.whl.

File metadata

  • Download URL: stockfish-3.6.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for stockfish-3.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0840ce5626697fee4d3e8386e2fff1bedaa5fbcf7edfd6e3cfb28e2f13de4a5f
MD5 a748683b3f019650e6adf94875f34176
BLAKE2b-256 5ebcb93b00c37fd333f839f0f5512b29a02dae51492007932ef1fee0933fa4b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page