lukasmonk / lucaschessR2

Lucas Chess R Version 2
GNU General Public License v3.0
266 stars 40 forks source link

[feature] Incremental analysis #153

Open Lingepumpe opened 2 months ago

Lingepumpe commented 2 months ago

When analysing a game via "Utilities->Analysis", you can set a time per move, and let it run. You then have variations for each move and evaluation shown next to the moves.

My suggestion is to allow to further improve an existing analysis, when the engine is run more: If I ran the analysis for 0.3s per move, it might not have fully understood some positions. If I open that position with the engine running as kibitzer, I would like the evaluation (and variation/variations) to be updated when the depth of the kibitzer surpasses the existing analysis depth. This would require to store the depth in addition to the already stored evaluation and engine name in the variations, e.g.: The top variation could be: "7. d4 {-0.56, Stockfish Latest, Depth 40} Nf5 8. c3 e6...." Then, when you run "Stockfish latest" as kibitzer in "best move" mode, the variation would not be updated while the depth is below 40, but once the depth gets higher, it would write it as the new "best variation". Similarly, if you ran the kibitzer in "Candidate" mode, it would update all the top 3 variations (like in analysis mode), once the best 3 candidate moves exceed the stored depths. Even if there was no prior analysis, once you use a kibitizer the information could already be added as variations automatically, allowing you to "build your own analysis" without using the Analysis feature itself.

In addition to "Kibitzer improved" analysis as described above, this would also allow the normal analysis to be run in a "incremental" way, where you don't need to specify the depth/time to use, it simply keeps improving the existing analysis until you abort it: This could be done by first analysing all the moves with a very low duration (e.g. 100ms per move), having a rough analysis done after a few seconds. Then it could double the time and repeat, improving the analyis. When done, again double and repeat. By increasing the time exponentially (2^t), the amount of wasted time is kept managable (below 50%). The use case for this is when you don't know exactly when you are going to check the analysis, but you want to get a "as good as possible" analysis of all the moves by the time you are ready for it (e.g. running an errand with uncertain duration while letting the computer analyse).

tissatussa commented 2 months ago

very good idea and well written. this user experience and wishes should be taken serious, those features would be the cherry on the pie, given LucasChess is already awesome ..

lukasmonk commented 2 months ago

Thanks for the idea. It is not easy to implement. One idea I have pending is to save in a file, positions and their analysis, and then be able to assign them in some way to games. This would allow updating analysis, although the data source would only be Kibitzers of the Candidates type.