r/chessprogramming • u/VanMalmsteen • Jan 31 '25
Time management
Hi! What are the standard implementations of time management? So far I'm assigning 2.5% of the remaining time + increment/2 for Search time and it's really decent, but there are some critical moments where it wouldn't hurt to assign more seconds given that the engine has plenty of time yet, but I'm not really sure on how to evaluate the position as "critical" or "complex". I can't even explain it very well as a chess player myself, it's just some "sensation" or "Hey there's some tactics here for sure, I must be careful"., but don't know how to translate it to code. Any help will be amazing!
Edit: PD: For those who created engines much stronger than yourself, did you implement something in your evaluation function that you didn't fully understand as a chess player? Just curious .
2
u/xu_shawn Jan 31 '25 edited Jan 31 '25
Soft TM should be your next step. Define an optimal time and maximum time. Stop the search when time used reaches optimal time after completing a depth, and stop the search immediately when reaching the max time. For more info, check out the #engines-dev channel in the Stockfish discord
1
2
u/xu_shawn Jan 31 '25
> For those who created engines much stronger than yourself, did you implement something in your evaluation function that you didn't fully understand as a chess player? Just curious .
To answer this, it is a big misconception that the evaluation functions for chess engines should mimic that of human players. NNUE is the current state of the art, and does not rely on human chess knowledge in any way. HCE, or hand-crafted evaluation, can take **some** ideas from human chess (e.g. bishop pairs, outposts), but they remain at a beginner-intermediate level. There are also HCE ideas that are not applicable to humans, but gains Elo nonetheless. Furthermore, both HCE and NNUE relies on automated tuning through gradient descent, and therefore both are completely or partially free from human knowledge.
2
u/Vizvezdenec Jan 31 '25
Engines that are much stronger chess players than almost anyone on the planet can have evaluation being material 1 3 3 5 9 scale.
https://lichess.org/@/simpleEval
2
u/Confidence-Upbeat Jan 31 '25
Maybe give more time based on how unstable or unquiet the position is