compiling stockfish with more options

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Rebel
Posts: 6991
Joined: Thu Aug 18, 2011 12:04 pm

Re: compiling stockfish with more options

Post by Rebel »

syzygy wrote: Sun Jan 13, 2019 2:03 pm
Rebel wrote: Sun Jan 13, 2019 4:57 am
syzygy wrote: Sun Jan 13, 2019 3:09 am
majkelnowaq wrote: Sat Jan 12, 2019 8:21 pm Here is my problem. I can add new tuning option just visually by adding something like "o["X"] << Option(100, 0, 100);" in ucioption.cpp but i cant actually connect it in proper way to some value. For example i want for "X" to change parameters in types.h file, we can say "QueenValueMg".
QueenValueMg is a compile-time constant. Compile-time constants cannot be changed at runtime.

You would have to turn QueenValueMg into a global variable. This is not trivial, since other places in Stockfish expect its value to be known at compile time. It would also slow Stockfish down a bit.
Actually QueenValueMg can be changed without loss of speed and change of code,
Not at runtime, as you seem to admit yourself.
The #define changes the constant during compilation, no loss of speed, no size change of the executable.
90% of coding is debugging, the other 10% is writing bugs.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: compiling stockfish with more options

Post by mcostalba »

You could use the 'tune' branch: https://github.com/official-stockfish/S ... /tree/tune

It has some code to allow automatic tuning of a variable in fishtest changing it's value at every game by means of an UCI option.

It has no slowdowns for non const parameters, and a possible small slow down for const ones because they should be converted to non-const for tune to work.

Read the comments in tune.h to get an idea of how to use it.