I'm planning on building a bitboard only move generator, and I'm trying to find the most efficient way to identify the captured piece (when there is one). I've read about move encoding with and without piece information; but either at move generation (and hence move encoding) or during makemove a capture piece type and location information is needed. Are there examples of engines that use this approach, or is it that many "man years" of trial and error have proved that the overhead of a mailbox for this single purpose is the way to go?
Thanks for any input on this topic,
Graham....
Bitboard only - identifying captured piece?
-
- Posts: 1242
- Joined: Thu Jun 10, 2010 2:13 am
- Real Name: Bob Hyatt (Robert M. Hyatt)
- Location: University of Alabama at Birmingham
- Contact:
Re: Bitboard only - identifying captured piece?
GrahamA wrote:I'm planning on building a bitboard only move generator, and I'm trying to find the most efficient way to identify the captured piece (when there is one). I've read about move encoding with and without piece information; but either at move generation (and hence move encoding) or during makemove a capture piece type and location information is needed. Are there examples of engines that use this approach, or is it that many "man years" of trial and error have proved that the overhead of a mailbox for this single purpose is the way to go?
Thanks for any input on this topic,
Graham....
Two real choices.
(1) keep a 64-byte array where each byte contains the piece type for what is on the corresponding square;
(2) search through the bit boards for one having a 1 on the target square. Something like:
(a) you know to only check white bit boards if black is moving, that eliminates 1/2 leaving only 6.
(b) more pawns than anything so start with pawns, then knights, then bishops, then rooks, then queens and finally king.
I do (a), but I have seen some that do (b) and the speed difference is not that great, if anything.
Re: Bitboard only - identifying captured piece?
Thanks for your reply. Interesting that they're closely matched, it does mean I could still go without the byte array.
Graham....
Graham....
-
- Posts: 1242
- Joined: Thu Jun 10, 2010 2:13 am
- Real Name: Bob Hyatt (Robert M. Hyatt)
- Location: University of Alabama at Birmingham
- Contact:
Re: Bitboard only - identifying captured piece?
I started off using the byte array, and have not changed. I know others that did not use it (Dark Thought, Chess Guru, at least).
I doubt there is a significant difference since this is not all that common an operation.
I doubt there is a significant difference since this is not all that common an operation.