Coder Social home page Coder Social logo

giorgiomegrelli / stockfishpy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dani4kor/stockfishpy

0.0 0.0 0.0 43 KB

Python Stockfish Chess Engine wrapper

Home Page: http://www.stockfishchess.com/

License: GNU General Public License v3.0

Python 90.91% Dockerfile 6.19% Shell 2.89%

stockfishpy's Introduction

Stockfishpy

PyPI version

Python Stockfish UCI Chess Engine wrapper


Getting Started:

pip3 install stockfishpy
  • Python 3.7+
  • Download and make 'Stockfish' executable
  • Setup stockfish PATH in stockfishpy.py

USAGE:

Python console Example

>>> from stockfishpy import *
>>> chess_engine = Engine(STOCKFISH_PATH, param={'Threads': 2, 'Ponder': 'true'})
>>> print(chess_engine.uci())
uciok

>>> print(chess_engine.isready())
readyok

>>> chess_engine.ucinewgame()
>>> chess_engine.setposition('rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1')
>>> move = chess_engine.bestmove()
>>> print(move.bestmove)
e7e5

>>> print(move.ponder)
g1f3

>>> print(move.info)
info depth 12 seldepth 16 multipv 1 score cp -32 nodes 296597 nps 2879582 tbhits 0 time 103 pv e7e5 g1f3 b8c6 f1b5 g8f6 d2d3 f8c5 e1g1 e8g8 b5c6 d7c6 f3e5 d8e7

>>> chess_engine.ucinewgame()
>>> chess_engine.setposition(['e2e4', 'e7e5', 'g1f3'])
>>> move = chess_engine.bestmove()
>>> print(move.bestmove)
b8c6

Tests:

  • Setup stockfish PATH in stockfishpy.py
  • Execute stockfishtest.py

License:

This project is licensed under the GPLv3 see the LICENSE file for details

stockfishpy's People

Contributors

dani4kor avatar giorgiomegrelli avatar julianopolito avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.