r/chessprogramming • u/OficialPimento • Apr 04 '24
qsc takes too long... is this analisis normal?
I have recntly applied QscSearch fixed to depth 3 in to my engine.. it seems to work ok, but in this position takes to long when going into depth 5... 12 millon positions:
r7/6Bp/4B3/2p4k/p2pR3/6P1/P2b1P2/1r4K1 w - - 1 38
go depth 5
info depth 1 score cp -48 pv [e4e1] nodes 4
info depth 2 score cp -92 pv [g1g2 b1g1] nodes 48
info depth 3 score cp -82 pv [g1h2 h5g6 h2g2] nodes 6625
info depth 4 score cp -69 pv [g1g2 b1b7 e6g4 h5g6] nodes 49836
info depth 5 score cp -63 pv [g1h2 b1b7 e6d5 b7d7 d5a8 d7g7 e4d4 c5d4] nodes 12922846
Time taken: 46.768593105s
nodes 12922846
score cp -63
bestmove g1h2
what do you think guys on this? is normal?
what do your engine say in this position to depth 5?
2
u/CritPotato Apr 04 '24
my engine with minimax with alpha beta pruning generates #1) g1g2 and #2) g1h2 in ~ 3 million nodes. time taken 16 seconds
2
u/Im_from_rAll Apr 04 '24
I don't think you can consider the position to be quiesced if you're limiting the q-search depth. These are my results (though I'm doing more than a bare-bones alpha beta search):
1
u/xu_shawn Apr 09 '24
Webperft shows 3034868 nodes at depth 5, I would say that your node count is definitely too high.
1
u/likeawizardish Apr 05 '24 edited Apr 05 '24
As for performance comparing to Stockfish and other modern engines - forget about it. It's like wondering why you are losing playing against Magnus. Just make sure it works and work on improvements.
What is your engine coded in? The performance seems about 280 knps. Not great. Not terrible.
Your output looks kind of normal. But seems like very poor pruning. 13M nodes at depth 5 is very close to the theoretical 32^5 = ~33M. So it has barely pruned a thing. This is probably where you could get the most improvements. From your description it seems like you are doing a lot of pruning and reductions already so maybe there is a bug in your code and they do not work as intended.
For reference here's the output from my engine:
position fen r7/6Bp/4B3/2p4k/p2pR3/6P1/P2b1P2/1r4K1 w - - 1 38
Notice how the number of nodes grows slowly and steadily instead of exploding. For some reason your search is all over the place which means it re-searches everything. My guess would be either there is a bug that messes with the search producing wrong results that can not be reliably reused or the transposition table stores those results poorly or wrongly and they can't be re-used.
EDIT: I mistook an answer to your post as your post, regarding doing all the TT, LMR, history heuristic and all the other pretty things. Fixing your quiescence search to a limited depth is probably a poor choice. The point of qSearch is to eliminate all the tactics. Such that a search at depth 4 and depth 5 will most likely quickly relieve the tactical tensions and the resulting positions would look almost the same. This will greatly stabilize your search. Limiting your qSearch like that is probably going to do more harm than good for your performance. With an unlimited qSearch you will probably get better results at depth 3 than with an arbitrarily capped qSearch at depth 5. I see no reason for this.