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!
How do you organize a self-play?
Moderator: Ras
-
- Posts: 17
- Joined: Fri Oct 25, 2019 2:51 pm
- Full name: Jaroslav Tavgen
-
- Posts: 5713
- Joined: Tue Feb 28, 2012 11:56 pm
Re: How do you organize a self-play?
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).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?
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.
-
- Posts: 584
- Joined: Tue Jul 03, 2018 10:19 am
- Full name: Folkert van Heusden
Re: How do you organize a self-play?
...or use 'sprt' in fastchess and let fastchess tell you what the result issyzygy wrote: ↑Mon Sep 15, 2025 6:10 pmThe 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).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?
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.

-
- Posts: 5713
- Joined: Tue Feb 28, 2012 11:56 pm
Re: How do you organize a self-play?
-
- Posts: 38
- Joined: Fri May 30, 2025 10:18 pm
- Full name: Ben Vining
Re: How do you organize a self-play?
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.
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.
-
- Posts: 17
- Joined: Fri Oct 25, 2019 2:51 pm
- Full name: Jaroslav Tavgen
Re: How do you organize a self-play?
Thank you for your answers!
Here is what I do. I use "VICE for JavaScript" which I've written on my own following these series:
I make this engine play itself 150 games. Two versions play agains each other: one where I tweaked some of the parameters and another is an original version. They play from starting position. First game: tweaked version plays as white, second game: tweaked version plays as black, third game: tweaked version plays as white etc.
Each win brings 1 point to the winning side and a draw gives 0.5 for both.
It takes 480 seconds to play 150 games.
And the variance is huge. For example, I've changed the array "pawnTable" which rewards the engine for putting pieces on certain squares. I changed the reward for putting the pawn on e4 from 20 to 19.
And the first time I made them play 150 the "tweaked" version lost miserably being 21 points behind. But the second time I made them play it won by 11 points!
I don't know what to do with variance. What am I doing wrong (probably everything but that's not the point)?
Here is what I do. I use "VICE for JavaScript" which I've written on my own following these series:
I make this engine play itself 150 games. Two versions play agains each other: one where I tweaked some of the parameters and another is an original version. They play from starting position. First game: tweaked version plays as white, second game: tweaked version plays as black, third game: tweaked version plays as white etc.
Each win brings 1 point to the winning side and a draw gives 0.5 for both.
It takes 480 seconds to play 150 games.
And the variance is huge. For example, I've changed the array "pawnTable" which rewards the engine for putting pieces on certain squares. I changed the reward for putting the pawn on e4 from 20 to 19.
And the first time I made them play 150 the "tweaked" version lost miserably being 21 points behind. But the second time I made them play it won by 11 points!
I don't know what to do with variance. What am I doing wrong (probably everything but that's not the point)?