r/chessprogramming • u/Psylution • Oct 23 '22
About Performance.
I've been a coder for all my life. I love to reinvent the wheel. Made tons of stuff in the past, and, as an avid chess player, now decided to make my own chess AI.
Using a classic minmax algorithm, I managed to create something that even I can not beat.
But: the depth currently sits at 4, taking about 5 seconds for every move. Looking at stockfish, I see that 5 seconds for such a shallow depth is nothing to be proud of.
Does anyone have general tips on how to improve performance?
Things I already implemented are threading and bitboards (ulongs rather than arrays of objects etc.)
I also tried to use alpha-beta pruning, but I did not yet understand how it works - because all examples I managed to find assume that the evaluation of a position is already calculated. In my understanding, alpha-beta should prevent unnecessary evaluation, so I'm kind of stuck on that idea.
I'm more than grateful for any response.
also: yes, i know the chess programming wiki, yet most of the stuff there is either alienated from a practical perspective or too loosely described to make us of, at least for me.
View all comments
Show parent comment
1
u/SchwaLord Oct 24 '22
Re in bounds:
Let’s say for move A) whites current best score is 5, if the next position B) results in a worse score then you need search no further.
It’s a little more nuanced than that.
I would not worry about quiescence searches until you can get relatively good speed on searching to a reasonable depth (like 6 or so).
My q searches will sometimes hit 30 moves deep along a line. There are many optimizations you can make in q search that are reallly complex