Page 1 of 1

attack bitboards, calculate or include?

Posted: Wed Feb 27, 2013 5:04 am
by DustinYoder
To generate moves we use 64bit attack bitboards. These are calculated at run time. Is there a header file that can be included that contains these bitboard arrays defined as a const for example. This would be useful to test with or just to use for move generation.
It just seems like this is so standard that they should be available somewhere as a .h file.

Re: attack bitboards, calculate or include?

Posted: Wed Feb 27, 2013 5:51 am
by User923005
The attack bitboards will be different, depending on many things.
You can choose different numbering systems for your bitboards (e.g. a1 can be square 0, a8 can be square 0... {others are possible but less common}).
Then, what sort of bitboard representation is it? Rotated bitboards, magic bitboards (there are many different sets here also), etc.

Once you have decided those things, now you have other things to consider as well.
Will you (for instance) generate every single pawn attack (including e.p. attacks) in one go, or will you do it incrementally, pawn by pawn or both?
Pawns also move and attack differently. You phrased the question as attack bitmaps, bit it appears that you are talking about any kind of move in your message.

How will you handle attack bitmaps for promotion? You could, if you had some strange bent, even have a bitmap for queen+knight to see if you attack some important piece on promotion. Not that any sane person has ever done that.

Once you have made decisions about board representation and generation method, the attack bitmaps sort of fall out by themselves (though there are some oddities like for edge pawns, depending upon how you do things).

I would be careful about using someone's attack bitmaps without asking them first. Even though there is nothing but simple math involved once you have decided on a board representation, some people get very sensi-poo about that sort of thing.