Hi, i have some i guess 'beginner' question.
Im not programmer but sometimes i try to change src files and test results.
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". I tried so many ways to do it as non-programmer could only do by intuitions shots but nothing works. Sometimes it doesnt pass to make exe file, sometimes passed but option in uci menu didnt work.
My questions is where (in which file) and what exactly i should add to connect chosen values with added lines in ucioption.cpp.
English isnt my native but i tried to be understood and i hope i ll, please - if u have some time to share -explain me this topic in simplest possible way.
compiling stockfish with more options
Moderators: hgm, Rebel, chrisw
-
- Posts: 28
- Joined: Fri Aug 10, 2018 4:07 pm
- Full name: D.S.
-
- Posts: 7025
- Joined: Thu Aug 18, 2011 12:04 pm
- Full name: Ed Schröder
Re: compiling stockfish with more options
90% of coding is debugging, the other 10% is writing bugs.
-
- Posts: 28
- Joined: Fri Aug 10, 2018 4:07 pm
- Full name: D.S.
Re: compiling stockfish with more options
Thanks for reply Rebel.
The funny thing is i already use this excellent tool, without it i would do probably nothing.
I have no problem with changing values by this tool, but its quite time-consuming to make a guess and then make .exe one by one with small fluctuations of values. If i have possibility to change values from uci menu in gui it would be incomparably faster for engine tests (faster like faster is copying engine in gui and change values than searching in files for parameters and make each time new exe with proper description to not forget what parameter was changed).
Anyway i dont ask for miracle. If it's really complicate and hard task to do what i wrote in first post, just say it. In the other hand if it's rather simple to implement and i could easily teach it, please share your thoughts.
The funny thing is i already use this excellent tool, without it i would do probably nothing.
I have no problem with changing values by this tool, but its quite time-consuming to make a guess and then make .exe one by one with small fluctuations of values. If i have possibility to change values from uci menu in gui it would be incomparably faster for engine tests (faster like faster is copying engine in gui and change values than searching in files for parameters and make each time new exe with proper description to not forget what parameter was changed).
Anyway i dont ask for miracle. If it's really complicate and hard task to do what i wrote in first post, just say it. In the other hand if it's rather simple to implement and i could easily teach it, please share your thoughts.
-
- Posts: 5569
- Joined: Tue Feb 28, 2012 11:56 pm
Re: compiling stockfish with more options
QueenValueMg is a compile-time constant. Compile-time constants cannot be changed at runtime.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".
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.
-
- Posts: 5569
- Joined: Tue Feb 28, 2012 11:56 pm
Re: compiling stockfish with more options
It may be easier to not have to recompile the engine, but if you are really trying to find the best values, you will anyway need to play so many games with each value you try that recompilation times are negligible.majkelnowaq wrote: ↑Sat Jan 12, 2019 10:00 pm I have no problem with changing values by this tool, but its quite time-consuming to make a guess and then make .exe one by one with small fluctuations of values. If i have possibility to change values from uci menu in gui it would be incomparably faster for engine tests (faster like faster is copying engine in gui and change values than searching in files for parameters and make each time new exe with proper description to not forget what parameter was changed).
-
- Posts: 7025
- Joined: Thu Aug 18, 2011 12:04 pm
- Full name: Ed Schröder
Re: compiling stockfish with more options
Actually QueenValueMg can be changed without loss of speed and change of code, the piece values (and other constants) are coded like this:syzygy wrote: ↑Sun Jan 13, 2019 3:09 amQueenValueMg is a compile-time constant. Compile-time constants cannot be changed at runtime.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".
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.
Code: Select all
#define PVM 1000/1000
#define PVE 1000/1000
#define NVM 1000/1000
#define NVE 1000/1000
#define BVM 1000/1000
#define BVE 1000/1000
#define RVM 1000/1000
#define RVE 1000/1000
#define QVM 1000/1000
#define QVE 1000/1000
PawnValueMg = 136*PVM, PawnValueEg = 208*PVE,
KnightValueMg = 782*NVM, KnightValueEg = 865*NVE,
BishopValueMg = 830*BVM, BishopValueEg = 918*BVE,
RookValueMg = 1289*RVM, RookValueEg = 1378*RVE,
QueenValueMg = 2529*QVM, QueenValueEg = 2687*QVE,
90% of coding is debugging, the other 10% is writing bugs.
-
- Posts: 7025
- Joined: Thu Aug 18, 2011 12:04 pm
- Full name: Ed Schröder
Re: compiling stockfish with more options
As syzygy already pointed out translating all the #defines to uci options would slow down the program, make it hard to read too since there are so many and most of it is a lot of workmajkelnowaq wrote: ↑Sat Jan 12, 2019 10:00 pm Thanks for reply Rebel.
The funny thing is i already use this excellent tool, without it i would do probably nothing.
I have no problem with changing values by this tool, but its quite time-consuming to make a guess and then make .exe one by one with small fluctuations of values. If i have possibility to change values from uci menu in gui it would be incomparably faster for engine tests (faster like faster is copying engine in gui and change values than searching in files for parameters and make each time new exe with proper description to not forget what parameter was changed).
Anyway i dont ask for miracle. If it's really complicate and hard task to do what i wrote in first post, just say it. In the other hand if it's rather simple to implement and i could easily teach it, please share your thoughts.
Stockfish probably is the most tuned engine on the planet since it is a community project and thus improvements are a) hard to find, b) produce small gains. They are there, waiting to be found, but you need patience, perseverance and determination.
90% of coding is debugging, the other 10% is writing bugs.
-
- Posts: 5569
- Joined: Tue Feb 28, 2012 11:56 pm
Re: compiling stockfish with more options
Not at runtime, as you seem to admit yourself.Rebel wrote: ↑Sun Jan 13, 2019 4:57 amActually QueenValueMg can be changed without loss of speed and change of code,syzygy wrote: ↑Sun Jan 13, 2019 3:09 amQueenValueMg is a compile-time constant. Compile-time constants cannot be changed at runtime.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".
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.
-
- Posts: 28
- Joined: Fri Aug 10, 2018 4:07 pm
- Full name: D.S.
Re: compiling stockfish with more options
Syzygy, Rebel thank you for interest and being helpful. I suspected it wont be trivial as it was said in this topic. Anyway i have some possibilities with stk tool and i ll still use it. Besides i already use stockfish derivatives with many options, i just was curious if i would be able to make one of them on my own, but its not most important.
I mean versions like SugaR.XPrO 220118 (https://mega.nz/#!y8oB0JYJ!NI_dBku8xv8b ... dDlH4obXqs), it has a lot values in uci like mobility, space, passed pawns, threats and many more or MZfish 110119 with ability to set values of all pieces (https://github.com/Zerbinati/MZfish/releases).
From time to time i find fun in testing different parameters in chess engines. One day i noticed for example that if we set material values to zero or value near of zero, then engine ll be genius in solving tactical positions (anyway fatal in real game) as i describe on fishcooking - https://groups.google.com/forum/#!searc ... 8CKRHoCwAJ
So once again thank u guys, if i would have further questions connected with chess engines/programming, i already know where i can find answers.
I mean versions like SugaR.XPrO 220118 (https://mega.nz/#!y8oB0JYJ!NI_dBku8xv8b ... dDlH4obXqs), it has a lot values in uci like mobility, space, passed pawns, threats and many more or MZfish 110119 with ability to set values of all pieces (https://github.com/Zerbinati/MZfish/releases).
From time to time i find fun in testing different parameters in chess engines. One day i noticed for example that if we set material values to zero or value near of zero, then engine ll be genius in solving tactical positions (anyway fatal in real game) as i describe on fishcooking - https://groups.google.com/forum/#!searc ... 8CKRHoCwAJ
So once again thank u guys, if i would have further questions connected with chess engines/programming, i already know where i can find answers.
-
- Posts: 5569
- Joined: Tue Feb 28, 2012 11:56 pm
Re: compiling stockfish with more options
So it is possible and not all too difficult, but it requires a bit of knowledge of C++ and several modifications to the source code. Since it would slow down Stockfish such changes will almost certainly not be made to the official Stockfish, but you or someone else could of course create a fork with such changes.majkelnowaq wrote: ↑Sun Jan 13, 2019 3:00 pm Besides i already use stockfish derivatives with many options, i just was curious if i would be able to make one of them on my own, but its not most important.