Code speaks louder than words, so here it is:
github.com/lucasart/zinc
Please note that:
* I do not intend to replicate all the functionalities of cutechess-cli. Only the ones useful for engine testing.
* This script is intended for programmers, not end-users, so I will not write a CLI (let alone a GUI), with idiot-proof input validation code. I will write some documentation, and try to keep the code clean and self-documentating, of course.
Feedback, suggestions, bug reports, bug fixes, are welcome. So are pull requests for new functionalities, provided they don't deviate from the aforementioned project goal of simplicity and minimalism.
Enjoy!
PS: Huge credit goes to Niklas Fiekas, for his python-chess library, without which this project would not exist!
cutechess-cli in python
Moderators: hgm, Rebel, chrisw
-
- Posts: 3232
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
cutechess-cli in python
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
-
- Posts: 3232
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: cutechess-cli in python
Some good progress was made on the project, as you can see on github: https://github.com/lucasart/zinc.git. Kudos to Andy for his great contributions.
Here's the gap-analysis compared to cutechess-cli:
Here's the gap-analysis compared to cutechess-cli:
- CLI: not implemented. just configure the parameters at the top of the script and run it.
- JSON: not implemented. not needed for now (no CLI).
- Variants: not implemented. will only support Chess960.
- Gaviota TB: not implemented. may add support for Syzygy.
- Tournaments: not implement. Only 2 engine matches for now.
- SPRT: not implemented. will implement.
- ratinginterval: not implemented. will implement.
- openings: only EPD, sequentially (repeated).
- pgnout: not implemented.
- recover: not implemented.
- repeat: the only behaviour available. EPD positions are always played twice, with colors reversed.
- restart: engines are never restarted. don't see any reason to restart engines, other than slowing things down, so won't support it.
- proto: only UCI. won't support CECP.
- timemargin: not implemented.
- book: not implemented.
- ponder: not implemented.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
-
- Posts: 27790
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: cutechess-cli in python
So apart from almost everything, it behaves exactly the same.
-
- Posts: 3232
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: cutechess-cli in python
Trolling as usual. You did not look at it, nor even looked at what is available in cutechess-cli.hgm wrote:So apart from almost everything, it behaves exactly the same.
It has all the features of cutechess-cli that are useful for fishtest, and more.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
-
- Posts: 27790
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: cutechess-cli in python
I looked at the list you posted, and almost everything that makes cutichess-cli a useful tool seems to be amongst the 'not supported'...
So the title of the thread is a bit misleading. This isn't like cutichess any more than any tool to play simple matches between UCI engines. As it is based on Python rather than Qt, 'pittichess-noncli' would be a more apt name.
It is a bit like saying that micro-Max is 'Stockfish in plain C'.
So the title of the thread is a bit misleading. This isn't like cutichess any more than any tool to play simple matches between UCI engines. As it is based on Python rather than Qt, 'pittichess-noncli' would be a more apt name.
It is a bit like saying that micro-Max is 'Stockfish in plain C'.
-
- Posts: 3232
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: cutechess-cli in python
Added Chess960 and PolyGlot opening book (weighted random selection up to book depth).lucasart wrote:Some good progress was made on the project, as you can see on github: https://github.com/lucasart/zinc.git. Kudos to Andy for his great contributions.
Here's the gap-analysis compared to cutechess-cli:All the rest is available, and behaves the same was as in cutechess-cli, modulo bugs
- CLI: not implemented. just configure the parameters at the top of the script and run it.
- JSON: not implemented. not needed for now (no CLI).
- Variants: not implemented. will only support Chess960.
- Gaviota TB: not implemented. may add support for Syzygy.
- Tournaments: not implement. Only 2 engine matches for now.
- SPRT: not implemented. will implement.
- ratinginterval: not implemented. will implement.
- openings: only EPD, sequentially (repeated).
- pgnout: not implemented.
- recover: not implemented.
- repeat: the only behaviour available. EPD positions are always played twice, with colors reversed.
- restart: engines are never restarted. don't see any reason to restart engines, other than slowing things down, so won't support it.
- proto: only UCI. won't support CECP.
- timemargin: not implemented.
- book: not implemented.
- ponder: not implemented.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
-
- Posts: 3232
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: cutechess-cli in python
It's going to replicate all the useful functionalities of cutechess-cli. Of course, it's not finished, but already you can see that development is several orders of magnitude faster than cutechess-cli; precisely because it's in Python, and I don't have to deal with all the bureaucracy of C++ / Qt to get the job done.hgm wrote:I looked at the list you posted, and almost everything that makes cutichess-cli a useful tool seems to be amongst the 'not supported'...
So the title of the thread is a bit misleading. This isn't like cutichess any more than any tool to play simple matches between UCI engines. As it is based on Python rather than Qt, 'pittichess-noncli' would be a more apt name.
It is a bit like saying that micro-Max is 'Stockfish in plain C'.
In my experience -- and I've used cutechess-cli a lot -- the CLI part of cutechess-cli adds zero value, in terms of usability. It's only necessary because C++ is a compiled language. There are so many parameters you need to put in cutechess-cli, that you end up having to write a shell script (and a JSON) around it, edit that script, and run it. That's exactly what you do with zinc: you edit the config at the top of the Python script and run it.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
-
- Posts: 2554
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: cutechess-cli in python
well, Python has the slowest interpreter I've ever seen. This is not about performance, sure (or is it? Pypy for the win!)lucasart wrote:It's going to replicate all the useful functionalities of cutechess-cli. Of course, it's not finished, but already you can see that development is several orders of magnitude faster than cutechess-cli; precisely because it's in Python, and I don't have to deal with all the bureaucracy of C++ / Qt to get the job done.
Plus you depend on python itself, a piece of bloat that has to load first to run your little script.
Why not Lua or something else that's lightweight (which you apparently like)? I guess because Python is cool.
So you've glued together some libs and made something that runs, congrats. How does it relate to the alleged "bureucracy" of C++ is beyond me. Have you just discovered what scripting languages are good for?
Also you don't need to depend on Qt at all to write something like cutechess-cli.
PS this nasty hack should prevent races? C'mon, you can do better
Code: Select all
# HACK: We can't just test jobQueue.empty(), then run jobQueue.get(). Between both
# operations, another process could steal a job from the queue. That's why we insert
# some padding 'None' values at the end of the queue
job = jobQueue.get()
if job == None:
return
-
- Posts: 1752
- Joined: Tue Apr 19, 2016 6:08 am
- Location: U.S.A
- Full name: Andrew Grant
Re: cutechess-cli in python
Hey, I'm proud of that "nasty" hack! :)
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
-
- Posts: 3232
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: cutechess-cli in python
Have you measured it ? Have you even tried it ? (+same questions on PyPy).mar wrote: well, Python has the slowest interpreter I've ever seen. This is not about performance, sure (or is it? Pypy for the win!)
Plus you depend on python itself, a piece of bloat that has to load first to run your little script.
I claim that you won't see a difference in any realistic testing scenario, because almost all the time is spend waiting for I/O operations.
I don't know anything about Lua, so I can't comment on that. And yes, Python is cool.Why not Lua or something else that's lightweight (which you apparently like)? I guess because Python is cool.
I never said it was hard. On the contrary, I'm saying it's easy, thanks to Python itself, and to the python-chess library of Niklas.So you've glued together some libs and made something that runs, congrats. How does it relate to the alleged "bureucracy" of C++ is beyond me. Have you just discovered what scripting languages are good for?
Agreed.Also you don't need to depend on Qt at all to write something like cutechess-cli.
Talk is cheap, show us your code...PS this nasty hack should prevent races? C'mon, you can do better
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.