cutechess-cli

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

Moderators: hgm, Rebel, chrisw

jarkkop
Posts: 198
Joined: Thu Mar 09, 2006 2:44 am
Location: Helsinki, Finland

cutechess-cli

Post by jarkkop »

If you run one match from book e.g position.bin. Is the starting book line always same or is it randonly selected?

If is always the same is there a way to force cutechess-cli by some seed value to give different book line?
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: cutechess-cli

Post by ilari »

Book moves (from Polyglot books) are always selected randomly, the highest-weighted move having the highest probability of getting picked. The random number generator is seeded at startup with the current time.
Gian-Carlo Pascutto
Posts: 1243
Joined: Sat Dec 13, 2008 7:00 pm

Re: cutechess-cli

Post by Gian-Carlo Pascutto »

By the way, there is a serious "bug" in the Qt random number generator when you start it with small seeds: the random numbers that come out are predictably always at the very low end of the range. This is due to an improper initialization of the linear congruential generator with a very small multiplier.

If you want to have reproducible openings, this will hit you because the moves played will not reflect the book statistics at all.

If you do not give the seed yourself, this doesn't affect you.
jarkkop
Posts: 198
Joined: Thu Mar 09, 2006 2:44 am
Location: Helsinki, Finland

Re: cutechess-cli

Post by jarkkop »

How do give the seed in cutechess-cli?

What is the seed range?
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: cutechess-cli

Post by ilari »

jarkkop wrote:How do give the seed in cutechess-cli?

What is the seed range?
You can't give the seed by yourself unless you modify the source code. The random number generator is seeded with QTime::currentTime(), and the range of the seed is 0 - 86400.
jarkkop
Posts: 198
Joined: Thu Mar 09, 2006 2:44 am
Location: Helsinki, Finland

Re: cutechess-cli

Post by jarkkop »

Could you add that as an optional parameter in next release?
User avatar
ilari
Posts: 750
Joined: Mon Mar 27, 2006 7:45 pm
Location: Finland

Re: cutechess-cli

Post by ilari »

Gian-Carlo Pascutto wrote:By the way, there is a serious "bug" in the Qt random number generator when you start it with small seeds: the random numbers that come out are predictably always at the very low end of the range. This is due to an improper initialization of the linear congruential generator with a very small multiplier.

If you want to have reproducible openings, this will hit you because the moves played will not reflect the book statistics at all.

If you do not give the seed yourself, this doesn't affect you.
Interesting. I'll run some tests to see if there's a problem. We only use Qt's random numbers for picking book moves.
Gian-Carlo Pascutto
Posts: 1243
Joined: Sat Dec 13, 2008 7:00 pm

Re: cutechess-cli

Post by Gian-Carlo Pascutto »

Ah you're right, I added this seed option to cutechess myself.

I checked the latest Qt sources and there it's just a thread safe wrapper around the system rand(). But I saw this on GNU libc, so this could hit others easily. The moral is: don't use small seeds.