Best way to get a big diversity of games in a given position

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Peperoni
Posts: 72
Joined: Sun Nov 01, 2020 5:27 pm
Full name: Richard Porti

Best way to get a big diversity of games in a given position

Post by Peperoni »

Hello,

Lets say I have a given position and 2 engines, what would be the best way to have the biggest diversity of games between those 2?
Does the naive approach to randomly choose a move based on the evaluation of different moves (instead of the best move) provide good results?

Thanks
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Best way to get a big diversity of games in a given position

Post by hgm »

For the first few moves of the game you could run the engines in multiPV mode, and randomly select one of the moves that still have an acceptable score. The smaller the window you define for what is acceptable, the more moves you have to do this to get the same diversity.
Peperoni
Posts: 72
Joined: Sun Nov 01, 2020 5:27 pm
Full name: Richard Porti

Re: Best way to get a big diversity of games in a given position

Post by Peperoni »

Thanks, that's what I had in mind.
Does the multiPV affect the depth of the variations calculated by the engines or does it just give a way to retrieve more variations?
Pio
Posts: 334
Joined: Sat Feb 25, 2012 10:42 pm
Location: Stockholm

Re: Best way to get a big diversity of games in a given position

Post by Pio »

Peperoni wrote: Sat Nov 07, 2020 7:43 pm Thanks, that's what I had in mind.
Does the multiPV affect the depth of the variations calculated by the engines or does it just give a way to retrieve more variations?
MultiPV takes more time to reach the same depth for an alpha-beta engine. An MCTS engine can return scores whenever but of course it spends different amount of time in the different parts of the tree so some scores may be more accurate than others.
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Best way to get a big diversity of games in a given position

Post by Dann Corbit »

If you want diversity, you should run more than one engine.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Best way to get a big diversity of games in a given position

Post by hgm »

The problem is that there might not be nearly as many different engines as you would want to do games, even when you count pairs of engines. If you do use different engines, a way to further drive up diversity is forcing them to play each other's opening lines.

MultiPV at same thinking time would be slightly weaker. But that is not really a problem, as in this phase you want to intentionally play non-best moves.
Peperoni
Posts: 72
Joined: Sun Nov 01, 2020 5:27 pm
Full name: Richard Porti

Re: Best way to get a big diversity of games in a given position

Post by Peperoni »

Thanks for the comments.

I also have noticed that in the same time controls settings, giving the same initial position, the engines don't always play the same variations, so I guess there is also some randomness in there.
Not sure if the randomness of the moves is due to the randomness of the time the engine decides to spend on one move, or if even if it spends the same time, the engine does not all the time picks the same move.
Any thoughts?
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Best way to get a big diversity of games in a given position

Post by hgm »

It depends on the engine. For multi-threaded searches there are many internal race conditions, where the relative timing of the threads can alter what happens. In single-threaded engines playing timed games there still is some variability in how far the search has progressed when the thinking times out. Even engines that can only abort the search at the start of a new iteration can still display some randomness when they finish the iteration in a time very close to the decision point for whether they should start a next iteration or move. (And even if that next iteration does not alter the played move, it will still alter the content of the transposiiton table, which affects what happens in the next move.) Only playing single-threaded by node count should be absolutely reproducible.

Of course there are engines that randomize their move intentionally; e.g. Fairy-Max can play any move that is not worse than 50cP compared to the best, in the first 4 moves of the game. GNU-Chess 5 also is explicitly randomizing, IIRC.