I recently started writing a chess engine and I was looking a bit at the literature. It seems as if incremental attack tables have gone out of fashion because updating them is complicated and they don't provide enough value to compensate for that.
I have a different idea on how to do incremental attack tables. I haven't seen this one in the literature, so I see three options (in the order of likelyhood):
- This idea has been tried out, I just didn't find it.
- Nobody tried it because it is stupid.
- It is indeed a useful new approach.
I called the approach "bitwise addition". It works as follows. The incremental attack table consists of 4 64-bit integers a0, a1, a2, a3 per color. Let x be the ith bit of x. To get the number of attacks of square i for a given color (numbered from 0 to 63) we interpret the ith bits of the stored numbers a0..a4 as a number. I.e. we use:
Code: Select all
a0[i] + 2 * a1[i] + 4 * a2[i] + 8 * a3[i]Code: Select all
a0 | a1 | a2 | a3.Code: Select all
carry = attack_board_for_new_square
new_a0 = a0 ^ carry
carry = a0 & carry
a0 = new_a0
new_a1 = a1 ^ carry
carry = a1 & carry
a1 = new_a1
new_a1 = a1 ^ carry
carry = a1 & carry
a1 = new_a1
a3 = a3 ^ carry
// Note that we don't need to update the carry here any more. It is guaranteed to be 0 since it is not possible that one color attacks a square 16 (or more) times.
What are your opinions? Did I miss something and this just sucks? Has it been done already? Is it maybe even an interesting idea?
