Re: fast(er) movegen
Posted: Mon Dec 10, 2018 5:01 pm
AdaChess uses a 10x12 array for the board design plus and a pieces-list to quickly find where the pieces are located.
The most expensive task while generating moves is the test for validity: not leaving the king in check. Therefore, engines tends to either don't test it (and leave the search to skip those nodes) or perform the legality check only when strictly required. AdaChess uses this second approach, by considering absolute pinned pieces movement, king escapes and so on.
Those are the best number on my Surface Pro after some tries. No hash used, and 1 core.
AdaChess, however, performs a search to detect the kind of check (if a move checks the opponent king), that makes the generation a bit more heavy than necessary.
In the italian forum, by talking about perft with other italian programmers, we agreed that once the move generator is optimized to reduce the legality test on the minimum, then there's no reason to spend more time to optimize it further (due to the limited amount of time that the engine spend in generating moves).
I believe that the optimization of the move generator became significant only once the engine reaches 3000+ Elo or when every small improvements matters.
The most expensive task while generating moves is the test for validity: not leaving the king in check. Therefore, engines tends to either don't test it (and leave the search to skip those nodes) or perform the legality check only when strictly required. AdaChess uses this second approach, by considering absolute pinned pieces movement, king escapes and so on.
Those are the best number on my Surface Pro after some tries. No hash used, and 1 core.
Code: Select all
Depth Nodes Captures En-Passant Castles Promotions Checks Checkmates Time
1 20 0 0 0 0 0 0 0.00
2 400 0 0 0 0 0 0 0.00
3 8902 34 0 0 0 12 0 0.00
4 197281 1576 0 0 0 469 8 0.02
5 4865609 82719 258 0 0 27351 347 0.47
6 119060324 2812008 5248 0 0 809099 10828 11.50
In the italian forum, by talking about perft with other italian programmers, we agreed that once the move generator is optimized to reduce the legality test on the minimum, then there's no reason to spend more time to optimize it further (due to the limited amount of time that the engine spend in generating moves).
I believe that the optimization of the move generator became significant only once the engine reaches 3000+ Elo or when every small improvements matters.