How do you organize a self-play?

Discussion of chess software programming and technical issues.

Moderator: Ras

jaroslav.tavgen
Posts: 16
Joined: Fri Oct 25, 2019 2:51 pm
Full name: Jaroslav Tavgen

How do you organize a self-play?

Post by jaroslav.tavgen »

I want to improve my engine by making it play itself. How should I organize it? What should be the time limit or searching-depth limit? How can I evaluate if a stronger version of engine won or was it just a pure luck?

Thank you!
syzygy
Posts: 5713
Joined: Tue Feb 28, 2012 11:56 pm

Re: How do you organize a self-play?

Post by syzygy »

jaroslav.tavgen wrote: Sun Sep 14, 2025 9:12 pm I want to improve my engine by making it play itself. How should I organize it? What should be the time limit or searching-depth limit? How can I evaluate if a stronger version of engine won or was it just a pure luck?
The more games the better. Let two versions play each other at very fast time controls (seconds per full game, not minutes) and play as many games in parallel as your computer has cores (or even threads).

Do not limit search depth. Limit total time for the game.

You can use cutechess-cli to run the games and keep track of the results.

Then learn about statistics to gain some understanding of when a result is significant or not.
User avatar
flok
Posts: 580
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: How do you organize a self-play?

Post by flok »

syzygy wrote: Mon Sep 15, 2025 6:10 pm
jaroslav.tavgen wrote: Sun Sep 14, 2025 9:12 pm I want to improve my engine by making it play itself. How should I organize it? What should be the time limit or searching-depth limit? How can I evaluate if a stronger version of engine won or was it just a pure luck?
The more games the better. Let two versions play each other at very fast time controls (seconds per full game, not minutes) and play as many games in parallel as your computer has cores (or even threads).

Do not limit search depth. Limit total time for the game.

You can use cutechess-cli to run the games and keep track of the results.

Then learn about statistics to gain some understanding of when a result is significant or not.
...or use 'sprt' in fastchess and let fastchess tell you what the result is :-)
syzygy
Posts: 5713
Joined: Tue Feb 28, 2012 11:56 pm

Re: How do you organize a self-play?

Post by syzygy »

flok wrote: Mon Sep 15, 2025 6:27 pm ...or use 'sprt' in fastchess and let fastchess tell you what the result is :-)
I did not know fastchess. It looks interesting!
https://github.com/Disservin/fastchess
benvining
Posts: 37
Joined: Fri May 30, 2025 10:18 pm
Full name: Ben Vining

Re: How do you organize a self-play?

Post by benvining »

Here's an example of integrating fastchess SPRT into a CMake workflow: https://github.com/benthevining/BenBot/ ... eLists.txt

I create 2 custom targets, sprt_set_baseline and sprt. sprt_set_baseline builds the engine and copies the binary to a eng_baseline file, sprt always tests the latest build against the last baseline. So then the workflow is, when I'm at a stable point, run sprt_set_baseline, then make some changes and run sprt, and that should tell you if your changes have helped or hurt.