mvanthoor / rustic

Rustic is a chess engine. It is written from scratch in the Rust programming language.
https://rustic-chess.org/
GNU General Public License v3.0
134 stars 7 forks source link

Depth is reported wrongly #29

Closed amanjpro closed 3 years ago

amanjpro commented 3 years ago

CuteChess GUI shows the depth (or seldepth?) as ~22, while in reality it is ~7

Screen Shot 2021-03-22 at 8 30 38 PM
uci
id name Rustic Alpha 2
id author Marcel Vanthoor
option name Hash type spin default 32 min 0 max 65536
option name Clear Hash type button
uciok
ucinewgame
position startpos
go infinite 
info score cp 70 depth 1 seldepth 1 time 0 nodes 21 nps 0 pv e2e4
info score cp 0 depth 2 seldepth 4 time 0 nodes 132 nps 0 pv e2e4 e7e5
info score cp 60 depth 3 seldepth 8 time 0 nodes 1068 nps 0 pv e2e4 e7e5 d2d4
info score cp 0 depth 4 seldepth 10 time 2 nodes 6372 nps 3186000 pv e2e4 e7e5 d2d4 d7d5
info score cp 20 depth 5 seldepth 14 time 56 nodes 274535 nps 4902411 hashfull 8 pv e2e4 e7e5 d2d4 d7d5 c1e3
info score cp 5 depth 6 seldepth 18 time 126 nodes 566795 nps 4498373 hashfull 19 pv d2d4 d7d5 e2e3 c8d7 c2c4 e7e6 c4d5 e6d5
info score cp 15 depth 7 seldepth 21 time 329 nodes 1631280 nps 4958298 hashfull 49 pv d2d4 d7d5 e2e3 e7e6 c1d2 c7c5 f1e2 c5d4 e3d4
info score cp 5 depth 8 seldepth 23 time 908 nodes 4131456 nps 4550062 hashfull 148 pv d2d4 d7d5 e2e3 e7e6 f1e2 c8d7 c2c4 f8d6 c4d5 e6d5
info currmove b1c3 currmovenumber 2
info time 2202 nodes 9961472 nps 4523829 hashfull 340
info currmove c2c3 currmovenumber 9
info time 4347 nodes 19922944 nps 4583148 hashfull 611
info currmove d2d3 currmovenumber 11
info currmove f2f3 currmovenumber 15
info score cp 15 depth 9 seldepth 27 time 5765 nodes 26807077 nps 4649970 hashfull 737 pv d2d4 d7d5 e2e3 e7e6 f1e2 c8d7 c1d2 f8d6 g1f3
info time 6687 nodes 30932992 nps 4625840 hashfull 800
info time 8745 nodes 39845888 nps 4556419 hashfull 897
info time 11071 nodes 50855936 nps 4593617 hashfull 951
info time 13281 nodes 61341696 nps 4618756 hashfull 979
info time 15410 nodes 71303168 nps 4627071 hashfull 990
info time 17452 nodes 81264640 nps 4656466 hashfull 995
info time 19565 nodes 90701824 nps 4635923 hashfull 998
info time 21600 nodes 99614720 nps 4611793 hashfull 999
info time 24289 nodes 112197632 nps 4619278 hashfull 999
info time 26433 nodes 122683392 nps 4641297 hashfull 999
info currmove b1c3 currmovenumber 2
info time 28471 nodes 131072000 nps 4603702 hashfull 999
info currmove g1h3 currmovenumber 4
info currmove b2b3 currmovenumber 7
info time 30587 nodes 138936320 nps 4542332 hashfull 999
info currmove c2c3 currmovenumber 9
info currmove c2c4 currmovenumber 10
info time 33037 nodes 148897792 nps 4507001 hashfull 999
info currmove d2d3 currmovenumber 11
info time 35194 nodes 157810688 nps 4484023 hashfull 999
info currmove e2e3 currmovenumber 13
info currmove e2e4 currmovenumber 14
info time 37280 nodes 166199296 nps 4458136 hashfull 1000
info currmove f2f3 currmovenumber 15
info score cp 10 depth 10 seldepth 33 time 39202 nodes 173647599 nps 4429560 hashfull 1000 pv d2d4 d7d5 e2e3 e7e6 g1f3 g8f6 f1b5 c7c6 b5e2 f8b4 c1d2 d8b6
info currmove d2d4 currmovenumber 1
info time 39638 nodes 175636480 nps 4431013 hashfull 1000
info time 41700 nodes 184025088 nps 4413072 hashfull 1000
info time 44386 nodes 197132288 nps 4441317 hashfull 1000
info time 46658 nodes 208142336 nps 4461021 hashfull 1000
amanjpro commented 3 years ago

Or maybe your seldepth gets incremented in QSearch? I don't think seldepth is meant to be incremented by QSearch, but I could be wrong

mvanthoor commented 3 years ago

Or maybe your seldepth gets incremented in QSearch? I don't think seldepth is meant to be incremented by QSearch, but I could be wrong

Hi,

The seldepth in the engine "can't be wrong", because it's purely cosmetic; it means what you as the programmer want it to mean. In my case, seldepth is the depth in ply the engine reaches at maximum, anywhere in the search tree. This is influenced by extensions (Rustic only has check extension for now), and also QSearch (which is basically a capture extension, on top of the main search).

After 5-6 plies, a few pieces and possibly the queens are out, causing capture sprees on both sides. That will cause qsearch to go very deep, and thus drive up the qsearch count. Even if you run Stockfish, which races off to depth 20 in a few seconds, has a QSearch/Seldepth of 35.

In later versions of Rustic, seldepth will probably decrease when I start to prune the search tree and reduce moves, and then increase again when the engine gets extensions.

PS: In Rustic, you don't have to do all the UCI stuff if you don't want to. If you want to do a search run from the starting position, you can just start the engine and type "go". It will work. If you want to run an analysis on a certain position with a specific hash table size, and not see the 2-second intermediate updates, use the -f, -h and -q options:

rustic.exe -f "<fen_string>" -h<size_in_mb> -q
amanjpro commented 3 years ago

Ah, thanks for educating me. I, in Zahak, only use seldepth for check-extension. But you are probably right, QSearch makes sense to keep track of, too

mvanthoor commented 3 years ago

Glad to be of help 👍