Pico V4 new test branch to get info from thinking engine

165 views
Skip to first unread message

Johan Sjöblom

unread,
Oct 31, 2025, 1:39:34 PM (7 days ago) Oct 31
to PicoChess
Hi brave testers of V4
Someone said that the final missing piece in V4 is the ability to get info like score, depth, bestmove from a thinking engine. The reason for this is that the new chess library hides that info in the go/play when we ask for a new engine move.

To get around this problem I rewrote the go/play. I have basic tested it, but as it changes tje core of the program, which is to play against engines, we need to test it before making a new pico version like 4.1.7.

The branch to test has this name:
109-info-updates-while-engine-thinking

The open issue info is here:

And the PR (pull request) is here:

Yours, Johan

Johan Sjöblom

unread,
Oct 31, 2025, 1:55:56 PM (7 days ago) Oct 31
to PicoChess
If someone is able to check that the uci communication towards the engine is still the same then we should be fine. Maybe there is some tool that can be used to do that? I dont know how to do that.
We are only interested in the uci communication when you play against the engine in this case.

Randy Reade

unread,
Oct 31, 2025, 2:09:36 PM (7 days ago) Oct 31
to pico...@googlegroups.com
You should be able to edit picochess.py and change the line that has logging.INFO to logging.DEBUG (there's a comment there about too many messages from python-chess). Then set picochess.ini debug level to Warning (so as not to get lost in PicoChess entries) and monitor it with 'tail -f /opt/picochess/logs/picochess.log'.

Randy

Johan Sjöblom

unread,
Nov 1, 2025, 4:14:20 AM (7 days ago) Nov 1
to PicoChess
Thanks for the advice Randy.

Ok, so it does look good to me. If anyone with uci protocol experience could check this it would be nice.  In my test branch mentioned above the call to the chess library engine.play() is replaced by engine.analysis() for indefinite analysis. Here is the log using Randys instructions above. I have only tested modern engines so far, and this is a test with LC0.

... running a testplay as white against LC0 with node restriction 10.000 and time blitz setting 3 2
... trying to avoid opening books by using e3, d3, Nd2, Ne2 so that engine starts playing
... here is the uci communication after my Ng1-e2 move
2025-11-01 09:46:06.377   DEBUG     engine - send_line: <UciProtocol (pid=5339)>: << position startpos moves e2e3 d7d5 d2d3 e7e5 b1d2 c7c5 g1e2
2025-11-01 09:46:06.378   DEBUG     engine - send_line: <UciProtocol (pid=5339)>: << go wtime 157400 btime 182900 winc 2000 binc 2000 nodes 10000
2025-11-01 09:46:06.380   DEBUG     engine - _line_received: <UciProtocol (pid=5339)>: >> info depth 7 seldepth 9 time 1 nodes 11 score cp 12 tbhits 0 pv b8c6 g2g3 h7h5 h2h4 g8f6 f1g2 f8e7 b2b3 e8g8
2025-11-01 09:46:06.383   DEBUG     engine - _line_received: <UciProtocol (pid=5339)>: >> info depth 7 seldepth 10 time 4 nodes 15 score cp 12 nps 3500 tbhits 0 pv b8c6 g2g3 h7h5 h2h4 g8f6 f1g2 f8e7 b2b3 e8g8 c1b2
2025-11-01 09:46:06.386   DEBUG     engine - _line_received: <UciProtocol (pid=5339)>: >> info depth 8 seldepth 10 time 8 nodes 17 score cp 13 nps 1500 tbhits 0 pv b8c6 g2g3 h7h5 h2h4 g8f6 f1g2 c8g4 f2f3 g4e6 e1g1
2025-11-01 09:46:06.388   DEBUG     engine - _line_received: <UciProtocol (pid=5339)>: >> info depth 8 seldepth 11 time 9 nodes 18 score cp 13 nps 1250 tbhits 0 pv b8c6 g2g3 h7h5 h2h4 g8f6 f1g2 c8g4 f2f3 g4e6 e1g1 d5d4
2025-11-01 09:46:06.395   DEBUG     engine - _line_received: <UciProtocol (pid=5339)>: >> info depth 8 seldepth 12 time 17 nodes 23 score cp 12 nps 1000 tbhits 0 pv b8c6 g2g3 h7h5 h2h4 g8f6 f1g2 c8g4 f2f3 g4e6 e1g1 d5d4 e3e4
2025-11-01 09:46:06.400   DEBUG     engine - _line_received: <UciProtocol (pid=5339)>: >> info depth 9 seldepth 12 time 21 nodes 27 score cp 12 nps 1000 tbhits 0 pv b8c6 g2g3 h7h5 h2h4 g8f6 f1g2 c8g4 f2f3 g4e6 e1g1 d5d4 e3e4
2025-11-01 09:46:06.402   DEBUG     engine - _line_received: <UciProtocol (pid=5339)>: >> info depth 9 seldepth 13 time 23 nodes 29 score cp 12 nps 954 tbhits 0 pv b8c6 g2g3 h7h5 h2h4 g8f6 f1g2 c8g4 f2f3 g4e6 e1g1 d5d4 e3e4 f8e7
... info lines cut ...
2025-11-01 09:46:07.336   DEBUG     engine - _line_received: <UciProtocol (pid=5339)>: >> info depth 13 seldepth 31 time 957 nodes 2750 score cp 8 nps 2871 tbhits 0 pv b8c6 g2g3 h7h5 h2h3 h5h4 g3g4 c8e6 f1g2 d8d7 e1g1 e8c8 b2b3 f7f5 g4f5 e6f5 e3e4
2025-11-01 09:46:07.616   DEBUG     engine - _line_received: <UciProtocol (pid=5339)>: >> info depth 13 seldepth 32 time 1237 nodes 3446 score cp 8 nps 2783 tbhits 0 pv b8c6 g2g3 h7h5 h2h3 h5h4 g3g4 c8e6 f1g2 d8d7 b2b3 g8f6 c1b2 e8c8 e1g1 f6g4 h3g4 e6g4 f2f3 g4e6 f3f4 h4h3 g2h1
2025-11-01 09:46:07.699   DEBUG     engine - _line_received: <UciProtocol (pid=5339)>: >> info depth 13 seldepth 32 time 1320 nodes 3752 score cp 8 nps 2840 tbhits 0 pv b8c6 g2g3 h7h5 h2h3 h5h4 g3g4 c8e6 f1g2 d8d7 b2b3 g8f6 c1b2 e8c8 e1g1 f6g4 h3g4 e6g4 f2f3 g4e6 f3f4 h4h3 g2h1
2025-11-01 09:46:07.704   DEBUG     engine - _line_received: <UciProtocol (pid=5339)>: >> bestmove b8c6 ponder g2g3
... now engine has delivered a bestmove Nb8-c6
....and I can see the two tutor analysis starting as normal deep with 17, and shallow with 5 to do !!, !... evaluations
... But that has not changed as the tutors never call play anyway, they always call analysis
2025-11-01 09:46:08.464   DEBUG     engine - send_line: <UciProtocol (pid=5366)>: << position startpos moves e2e3 d7d5 d2d3 e7e5 b1d2 c7c5 g1e2 b8c6
2025-11-01 09:46:08.465   DEBUG     engine - send_line: <UciProtocol (pid=5366)>: << go depth 17
...
2025-11-01 09:46:08.823   DEBUG     engine - send_line: <UciProtocol (pid=5372)>: << position startpos moves e2e3 d7d5 d2d3 e7e5 b1d2 c7c5 g1e2 b8c6
2025-11-01 09:46:08.824   DEBUG     engine - send_line: <UciProtocol (pid=5372)>: << go depth 5

Johan Sjöblom

unread,
Nov 1, 2025, 4:47:03 AM (7 days ago) Nov 1
to PicoChess
For reference I switched back to the existing master branch that still uses the engine.play() call to do moves. I can see now that I need to turn off picotutor to get better test results. Here is still with picotutor on so the info lines coming in before the engine move is just from the tutor engine. But I think we can see here that the calls to go are the same

... testing current master branch to see difference ... exactly same go call ....
2025-11-01 10:36:38.759   DEBUG     engine - send_line: <UciProtocol (pid=7827)>: << position startpos moves e2e3 g7g6 d2d3 c7c5 b1d2 g8f6 g1e2 d7d5 g2g3 b8c6 f1g2 f8g7 e1g1
2025-11-01 10:36:38.760   DEBUG     engine - send_line: <UciProtocol (pid=7827)>: << go wtime 139000 btime 186900 winc 2000 binc 2000 nodes 10000
2025-11-01 10:36:38.762   DEBUG     engine - _line_received: <UciProtocol (pid=7827)>: >> info depth 12 seldepth 15 time 1 nodes 2002 score cp 6 tbhits 0 pv e8g8 h2h3 b7b6 c2c4 c8b7 c4d5 f6d5 a2a3 d8d7 d1c2 f8d8 f1d1 a8c8 d2c4 b6b5 c4d2 c6e5 e2f4 d5f4
2025-11-01 10:36:38.768   DEBUG     engine - _line_received: <UciProtocol (pid=7827)>: >> info depth 12 seldepth 20 time 7 nodes 2007 score cp 6 nps 1800 tbhits 0 pv e8g8 h2h3 b7b6 c2c4 c8b7 c4d5 f6d5 a2a3 d8d7 d1c2 f8d8 f1d1 a8c8 d2c4 b6b5 c4d2 c6e5 e2f4 d5f4
2025-11-01 10:36:38.832   DEBUG     engine - _line_received: <UciProtocol (pid=7827)>: >> info depth 11 seldepth 20 time 71 nodes 2136 score cp 6 nps 2000 tbhits 0 pv e8g8 h2h3 e7e5 e3e4 d5d4 f2f4 e5f4 e2f4 f8e8 d2c4 b7b5 c4d2 a8b8 a2a4 b5b4 d2c4 b4b3 c2b3 c6b4 c1d2
2025-11-01 10:36:38.879   DEBUG     engine - _line_received: <UciProtocol (pid=7827)>: >> info depth 10 seldepth 20 time 118 nodes 2224 score cp 7 nps 1948 tbhits 0 pv e8g8 h2h3 e7e5 e3e4 d5d4 f2f4 e5f4 e2f4 f8e8 d2c4 b7b5 c4d2 a8b8 a2a4 b5b4 d2c4 b4b3 c2b3 c6b4 c1d2
2025-11-01 10:36:38.899   DEBUG     engine - _line_received: <UciProtocol (pid=7827)>: >> info depth 11 seldepth 20 time 138 nodes 2253 score cp 7 nps 1875 tbhits 0 pv e8g8 h2h3 e7e5 e3e4 d5d4 f2f4 e5f4 e2f4 f8e8 d2c4 b7b5 c4d2 a8b8 a2a4 b5b4 d2c4 b4b3 c2b3 c6b4 c1d2
2025-11-01 10:36:38.962   DEBUG     engine - _line_received: <UciProtocol (pid=7827)>: >> info depth 11 seldepth 20 time 201 nodes 2352 score cp 7 nps 1778 tbhits 0 pv e8g8 h2h3 e7e5 e3e4 d5d4 f2f4 e5f4 e2f4 f8e8 d2c4 b7b5 c4d2 a8b8 a2a4 b5b4 d2c4 b4b3 c2b3 c6b4 c1d2
2025-11-01 10:36:38.965   DEBUG     engine - _line_received: <UciProtocol (pid=7827)>: >> bestmove e8g8 ponder h2h3
... and tutor engines start the same as in branch as they have not changed...
2025-11-01 10:36:39.679   DEBUG     engine - send_line: <UciProtocol (pid=7867)>: << position startpos moves e2e3 g7g6 d2d3 c7c5 b1d2 g8f6 g1e2 d7d5 g2g3 b8c6 f1g2 f8g7 e1g1 e8g8
2025-11-01 10:36:39.680   DEBUG     engine - send_line: <UciProtocol (pid=7867)>: << go depth 17

... info lines cut ...
2025-11-01 10:36:39.994   DEBUG     engine - send_line: <UciProtocol (pid=7873)>: << position startpos moves e2e3 g7g6 d2d3 c7c5 b1d2 g8f6 g1e2 d7d5 g2g3 b8c6 f1g2 f8g7 e1g1 e8g8
2025-11-01 10:36:39.995   DEBUG     engine - send_line: <UciProtocol (pid=7873)>: << go depth 5


Johan Sjöblom

unread,
Nov 1, 2025, 5:08:58 AM (7 days ago) Nov 1
to PicoChess
Ah, just a note to above. The info lines in master (the later and previous post above) probably does come from the engine as the tutor is not running while the engine is thinking. To me this means that the engine is always sending info lines during its thinking, but the engine.play() call in the new chess library hides them from picochess. They are still there...

I did find a bug in V4, even though picotutor watcher was off the tutor still runs in the background asking info lines from the tutor engine while the user is thinking. Need to sort that out! But thats not related to this test.

DJ Dekker

unread,
Nov 1, 2025, 6:04:14 AM (7 days ago) Nov 1
to PicoChess
I have tested the new code from 109-info-updates-while-engine-thinking with several classical engines. Also tested functions like move takeback, alternative move etc. I encountered no problems at all, everything worked fine.

Op zaterdag 1 november 2025 om 09:14:20 UTC+1 schreef messi...@gmail.com:

Johan Sjöblom

unread,
Nov 1, 2025, 8:49:10 AM (7 days ago) Nov 1
to PicoChess
This branch is now merged into master. Thanks to DJ Dekker and Antonio for testing.
Now we get info (depth, score, pv) from the engine while the engine is thinking about its move.

Next I need to fix the picotutor bug 127, and then see if we could get updated info from engine also during user turn. I wanted to do this in steps so now I am only asking for info updates from the engine while its the engines turn... but it should be possible now to also ask for updates during user turn.

Johan Sjöblom

unread,
Nov 1, 2025, 3:30:00 PM (6 days ago) Nov 1
to PicoChess
Had to hotfix the branch. The ChatGPT Codex is good, but it had broken "normal analysis modes like Hint On etc". I had to fix this one myself.
I will continue testing the master branch. As far as I can see now it analyses and when you are playing the engine you get updated analysis when its the engines move.

Next I will experiment with the issue 128 https://github.com/JohanSjoblom/picochess/issues/128
This could bring analysis updates also when its user turn...

Johan Sjöblom

unread,
Nov 2, 2025, 2:49:12 AM (6 days ago) Nov 2
to PicoChess
There is now a test branch that can get updates on info (depth, score, pv) from engine while its user turn... Current master only updates while the engine is thinking.
The catch is that it might sometimes provide lower depth as analysis is controlled by the engine implementation, see the question in the PR:
So we can do this, but first we need some opinions on HOW do we want to do this

The branch name is 128-get-playing-engine-info-on-user-turn

Johan Sjöblom

unread,
Nov 5, 2025, 1:03:06 PM (2 days ago) Nov 5
to PicoChess
I have improved the test branch 128-get-playing-engine-info-on-user-turn for the pull request 131 above.
Now engine analysis is updated also during user thinking time, but ONLY if the depth has reached a higher value than what we got from the engine when it made its move decision.
I have tested this branch and if this feature is OK we can merge it into master... A small question is still that do we want some mode where we would NOT get the updated engine analysis during user thinking.

Reply all
Reply to author
Forward
0 new messages