Python and Stockfish (pystockfish)

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Python and Stockfish (pystockfish)

Post by mcostalba »

JoshPettus wrote:In a game where every millisecond can count, wouldn't you want your interface between two engines to be fast as possible? Why would python be a good solution for this? I fully expect I have some misconceptions on the matter, so I'm curious. Why is this a better solution then say xboard which is in C?
It is not the real lag between the engines that matters, if it is acconted correctly (eg. not like the buggy Arena).

A engine vs engine manager should start/stop the timer upon sending/receiving the move from teh engine, what happens and how much time it takes until it sends the new position to the opponent engine does not matters.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: Python and Stockfish (pystockfish)

Post by mcostalba »

iamjarret wrote:**RELEASE**

Pystockfish is a Python interface for the stockfish engine to run engine vs. engine matches, and version 1.0.1 is now compatible with Python 3!

PYPI:
https://pypi.python.org/pypi/pystockfish/1.0.1

GITHUB:
https://github.com/iamjarret/pystockfish/

Thanks everyone,
Jarret
Thanks for this, but engine vs. engine matches requires a tournament manager. Current ones do call teh exe directly so no need this.

Bit if you develop a new python one above this package then this would be useful for fishtest testing because, as Lucas said, we can get rid of cutechess and do all in Python that is the language the fishtest framework is currently implemented.
iamjarret
Posts: 6
Joined: Sun Dec 01, 2013 4:57 pm
Location: New York

Re: Python and Stockfish (pystockfish)

Post by iamjarret »

Marco, Lucas, and Josh, many thanks for the question and suggestions. I understand that Pystockfish may be modified to help fishtest in two ways. The first would be to maintain fishtest's current concurrency framework by wrapping Pystockfish's match class in an executable, while adding extra options! The second improvement would be to develop concurrency with threads within Pystockfish.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Python and Stockfish (pystockfish)

Post by lucasart »

[quote="iamjarret"]Marco, Lucas, and Josh, many thanks for the question and suggestions. I understand that Pystockfish may be modified to help fishtest in two ways. The first would be to maintain fishtest's current concurrency framework by wrapping Pystockfish's match class in an executable, while adding extra options! The second improvement would be to develop concurrency with threads within Pystockfish.[/quote]
The parallelism is handed at two levels:
* fishtest distributes tasks to the workers
* each worker runs a tasks (or is waiting for sth to do)
* a task consists in playing N games between two UCI engines (two versions of SF), with a given concurrency (nb of games to play in parallel). Obviously, that means N/2 openings chosen randomly in an EPD file, played twice with reversed colors. time+inc or tournament tc. This is what your code needs to do to replace cutechess-cli in fishtest.

There are many benefits to replacing cutechess-cli by native Python:
* lower the barrier of entry and allow people to make non trivial changes. Cutechess is a huge codebase, that requires good C++.and especially Qt knowledge.
* eliminate all the problems linked to compiling cutechess for various platforms, and distributing it to the workers.

For example, we could finally implement node is time correctly, and use EPD books on Windows instead of PGN.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.