I'm currently developing a bitboard-based chess engine for fun and can generate around 5.5 million positions per second on perft tests. I ran the same tests on Stockfish, which can do around 130 million positions per second. What is it that makes Stockfish (and other engines) so much faster?
-
1Probably wrong here. It is best to ask this at talkchess (talkchess.com/forum3/index.php), it is a regular chess coders forum, there some good ones are hanging around and they like to answer that. Consider posting some source code from you, otherwise really nobody knows what you really want.– user27863May 28, 2021 at 8:09
-
1Might be interesting for you: Parallel processing for Stockfish link.springer.com/chapter/10.1007/978-3-319-93713-7_40– Hauke ReddmannMay 28, 2021 at 18:37
-
6Other than following @adrasthea advice of posting this question in talkchess, you should try to improve it. In which language have you written your engine? What's your level of expertise at this language? Are you sure its move generator is bug free? Are you testing both engines under the same conditions? (it doesn't make sense to compare no parallelized and parallelized engines) Can you show your code?– emdioMay 29, 2021 at 8:10
-
Classical bitboard implementations involving linear scanning are a far cry from Magic bitboards. It's a looong rabbit hole. Have you read for example rhysre.net/fast-chess-move-generation-with-magic-bitboards.html?– BaseZenMay 29, 2021 at 21:51
1 Answer
There are a number of reasons. The Main one is its aggressive Alpha Beta pruning and late move reductions.
To explain a bit further. AB Pruning is a search algorithm which basically cuts out the number of nodes in its search tree. How it works is it stops evaluating when it determines and proves the move to be worse than another examined moves.
Late move reduction is a slightly harder concept but it again searches the "tree" more efficiently. It does this by effectively diving down a "algorithmically" more probably tree.
If I remember the release paper correctly the elo for Stockfish 14 is 3350 +/-5% and that was based off a 4 threaded CPU.
In short there are the implementation of mathematically proven formulae to do with pruning infinite possibilities to the most correct, whilst also searching deeper down the most probably correct line.