I've run into something that seems interesting so here I go..
Recently I started writing my own UCI engine (magog) from scratch.
I pit it against other engine in blitz time setting: 2min + 1s.
In one of the games my engine failed due to a bug in calculation of time dedicated for the next move.
However after looking at arena.debug more closely I've noticed that Arena actually allowed magog to get away with it (for a bit at least).
Anyway here's the relevant Arena log. I've edited it a bit. Unrelevant info is truncated and I added comments above relevant lines:
Code: Select all
2024-06-15 20:14:52,368-->1:position startpos moves [...] c4d5 c7b8 d4e5 b8a7 e5d4 a7a6 d5c6 a6a5 d4c5 a5a6 e7e6 a6a5 e6d6 a5a6 c5d4 a6a5 d6c5 a5a6 c6d5 a6a5 d4e5
// magog has 1 millisecond to move and will get another second after that move
2024-06-15 20:14:52,368-->1:go wtime 1 btime 6354 winc 1000 binc 1000
2024-06-15 20:14:52,384<--1:info depth 2 score cp -876 nps 98619 time 0 nodes 50 pv a5a4 d5e4
2024-06-15 20:14:52,399<--1:info depth 3 score cp -870 nps 156862 time 0 nodes 104 pv a5a4 e5c3 a4a3
2024-06-15 20:14:52,415<--1:info depth 4 score cp -885 nps 655803 time 1 nodes 1147 pv a5a4 e5c3 a4a3 c3e5
2024-06-15 20:14:52,436<--1:info depth 5 score cp -876 nps 900220 time 2 nodes 2039 pv a5a4 e5c3 a4a3 c3e5 a3a4
2024-06-15 20:14:52,456<--1:info depth 6 score cp -880 nps 1367706 time 30 nodes 42031 pv a5a4 d5e4 a4b3 c5b5 b3a3 b5c5
2024-06-15 20:14:52,477<--1:info depth 7 score cp -877 nps 1370276 time 60 nodes 83084 pv a5a4 c5c4 a4a5 d5b7 a5a4 b7e4 a4a5
2024-06-15 20:14:52,868<--1:info score cp -885 depth 8 nps 1710372 time 473 nodes 809189 pv a5a4 c5c4 a4a5 e5c7 a5a4 c4c5 a4a3 c7e5
2024-06-15 20:14:52,889<--1:info depth 8 score cp -885 nps 1712056 time 473 nodes 809986 pv a5a4 c5c4 a4a5 e5c7 a5a4 c4c5 a4a3 c7e5
2024-06-15 20:14:53,013<--1:info currmove a5a4 currmovenumber 1 nodes 1000000 time 617 nps 1620430
// however it can be clearly seen that it's been thinking for a second. As if Arena incremented it's time in advance
2024-06-15 20:14:53,378<--1:info score cp -885 depth 8 nps 1496163 time 987 nodes 1476989 pv a5a4 c5c4 a4a5 e5c7 a5a4 c4c5 a4a3 c7e5
2024-06-15 20:14:53,394<--1:bestmove a5a4
2024-06-15 20:14:53,394*1*Found move:Ka5-a4
2024-06-15 20:14:53,555*2*Child Process Prio Adj: PID 7000 conhost.exe
2024-06-15 20:14:53,555*2*Start calc, move no: 246
2024-06-15 20:14:53,555-->2:position startpos moves [...] c4d5 c7b8 d4e5 b8a7 e5d4 a7a6 d5c6 a6a5 d4c5 a5a6 e7e6 a6a5 e6d6 a5a6 c5d4 a6a5 d6c5 a5a6 c6d5 a6a5 d4e5 a5a4
2024-06-15 20:14:53,555-->2:go wtime 1 btime 6328 winc 1000 binc 1000
[...] //opponent thinking
2024-06-15 20:14:54,053<--2:info string 8: e5c3-a4a3-c5d6-a3a4-d5c4-a4a3-c4d5-fif-> (+0)
2024-06-15 20:14:55,199<--2:info string interrupted
2024-06-15 20:14:55,199<--2:info string t=1633 max_n=11
2024-06-15 20:14:55,201<--2:bestmove e5c3 ponder a4a3
2024-06-15 20:14:55,201*2*Found move:Be5-c3
2024-06-15 20:14:55,356*1*Child Process Prio Adj: PID 12780 conhost.exe
2024-06-15 20:14:55,356*1*Start calc, move no: 247
2024-06-15 20:14:55,356-->1:position startpos moves [...] c4d5 c7b8 d4e5 b8a7 e5d4 a7a6 d5c6 a6a5 d4c5 a5a6 e7e6 a6a5 e6d6 a5a6 c5d4 a6a5 d6c5 a5a6 c6d5 a6a5 d4e5 a5a4 e5c3
// another turn for magog! Didn't get flagged!
2024-06-15 20:14:55,356-->1:go wtime 1 btime 6328 winc 1000 binc 1000
// This time however it really interrupts the search at the very beginning - h
2024-06-15 20:14:55,366<--1:info score cp -870 depth 1 nps 1000000 time 0 nodes 1 pv a4a3
2024-06-15 20:14:55,388<--1:bestmove a4a3
// and Arena lets it get away with it.. the game continues
2024-06-15 20:14:55,388*1*Found move:Ka4-a3
2024-06-15 20:14:55,552*2*Child Process Prio Adj: PID 7000 conhost.exe
2024-06-15 20:14:55,552*2*Start calc, move no: 248
2024-06-15 20:14:55,552-->2:position startpos moves [...] c4d5 c7b8 d4e5 b8a7 e5d4 a7a6 d5c6 a6a5 d4c5 a5a6 e7e6 a6a5 e6d6 a5a6 c5d4 a6a5 d6c5 a5a6 c6d5 a6a5 d4e5 a5a4 e5c3 a4a3
2024-06-15 20:14:55,552-->2:go wtime 1 btime 7301 winc 1000 binc 1000
[...] //opponent thinking again
2024-06-15 20:14:57,302<--2:bestmove c5d6 ponder a3a4
2024-06-15 20:14:57,302*2*Found move:Kc5-d6
[...] //only now Arena adjudicates that magog losses on time
2024-06-15 20:14:57,459****Tour**Game end: 0-1 {0-1 White forfeits on time}
2024-06-15 20:14:57,459****Tour**Last game won by EnkoChess_290818 with Black in 125 moves
This phenomenon makes me wonder whether it could be exploited to gain some extra time.
Or maybe there's just something I don't understand in UCI or how time is measured?