Magic and precomputation
Posted: 23 Sep 2007, 19:57
Hello,
almost a year ago, Pradu and others suggested a new way to compute attack bitboards: magic multipliers. In the meantime it got quiet about this topic. As far as I remember the discussions, there was the suggestion to use precomputed move lists together with magic, but nobody posted how to do this.
Precomputed move lists obviously need enormous amounts of memory, so let's consider the easier task to count moves by magic (useful for eval).
The obvious way to do this is:
1. get attack bitboard by magic
2. remove own pieces from attack bitboard
3. do a popcount
Unfortunately, this is fairly slow. Are there better ways to count moves with bitboards (magic or non-magic)?
In above approach, if we replace the popcount by another magic lookup
- we have a different pattern to look up than in step one, so we do a new computation of an index and for the lookup we access memory at a diffent address
- the squares at the border of the board are relevant, so the masks have up to four more bits.
Can these problems be solved?
almost a year ago, Pradu and others suggested a new way to compute attack bitboards: magic multipliers. In the meantime it got quiet about this topic. As far as I remember the discussions, there was the suggestion to use precomputed move lists together with magic, but nobody posted how to do this.
Precomputed move lists obviously need enormous amounts of memory, so let's consider the easier task to count moves by magic (useful for eval).
The obvious way to do this is:
1. get attack bitboard by magic
2. remove own pieces from attack bitboard
3. do a popcount
Unfortunately, this is fairly slow. Are there better ways to count moves with bitboards (magic or non-magic)?
In above approach, if we replace the popcount by another magic lookup
- we have a different pattern to look up than in step one, so we do a new computation of an index and for the lookup we access memory at a diffent address
- the squares at the border of the board are relevant, so the masks have up to four more bits.
Can these problems be solved?