reuse of generated moves?
Posted: 02 Feb 2006, 22:24
The fact that many of the legal moves on one side of the board are the same between turns has made me wonder if it could payoff to keep track of which ones could be reused and thereby save some computation time.
I figure it might be dependant on the engine, e.g. if you use rotated bitboards or a more primitive data structure.
I keep track of all threatened squares in my own program, and I reuse that information in situations where the threats haven't changed for the player who didn't make the last move, i.e. the pieces haven't moved. This gave me a significant speedup!
I imagine something like ruling out files and diagonals (including the kings' to avoid checking problems) for reuse for each move made on the board. That combined with keeping track of each piece's legal moves could make up such an algorithm, but the question is if the bookkeeping is worth it...
Does anyone have any experiences with something like that?
I figure it might be dependant on the engine, e.g. if you use rotated bitboards or a more primitive data structure.
I keep track of all threatened squares in my own program, and I reuse that information in situations where the threats haven't changed for the player who didn't make the last move, i.e. the pieces haven't moved. This gave me a significant speedup!
I imagine something like ruling out files and diagonals (including the kings' to avoid checking problems) for reuse for each move made on the board. That combined with keeping track of each piece's legal moves could make up such an algorithm, but the question is if the bookkeeping is worth it...
Does anyone have any experiences with something like that?