Use threats in quiet move generation and simplify castling check in pos.legal()#6288
Use threats in quiet move generation and simplify castling check in pos.legal()#6288ces42 wants to merge 8 commits into
Conversation
including castling when !chess960
also simplify pos.legal() with the new definition of pseudo-legal castling
bench: 2586153
|
clang-format 20 needs to be run on this PR. (execution 17411532491 / attempt 1) |
|
mh i don't really see this as an improvement.. curious what others think |
|
I would like to see this merged for the following reasons: Generating king moves that are scored and sorted in the move picker, only to be discarded later in the search by pos.legal(), has always seemed a bit odd to me. Improve move-count pruning Improve null-move pruning / verification search Improve evaluation correction Having this committed would give us the opportunity to experiment without too much effort. |
|
This is pretty outdated by now, and I wasn't too excited about this. However @ces42 you feel this is still relevant? |
Recent changes to movepicker mean that we're computing (almost all) threatened squares for quiet move ranking. This patch uses the bitboard of all threatened square in movegen to avoid generating any illegal king move in the quiet stage. This allows removing the code in
pos.legal(Move)that checks whether the king moves through a threatened square when castling.I was hoping this would lead to a speedup since we no longer need to rank and sort the illegal king moves, but that doesn't seem to be the case.
Tests were done agains an older version of master, but rebasing is straightforward.
passed STC: https://tests.stockfishchess.org/tests/view/68ade27c6217b8721dca9765
LLR: 2.97 (-2.94,2.94) <-1.75,0.25>
Total: 198720 W: 51786 L: 51741 D: 95193
Ptnml(0-2): 712, 23321, 51261, 23342, 724
passed LTC: https://tests.stockfishchess.org/tests/view/68b1c4c26217b8721dca9c56
LLR: 2.95 (-2.94,2.94) <-1.75,0.25>
Total: 277068 W: 70944 L: 70984 D: 135140
Ptnml(0-2): 154, 30225, 77815, 30187, 153