Talk:Bitboard

Rotated bitboards
Are most chess bitboard engines rotated? Does anyone have information on this or can lend an expert opinion?

- A question: Why is it said about a dozen times that implementing a bitboard is rather hard to do? There are a lot of things that are difficult (look at all of the math articles) but i think Wikipedia should be informative, rather than rating the stuff... Anyone agree?


 * Yes, I agree. In general, this article is written in a very casual style that in not encyclopedic. Rm999 02:40, 30 April 2006 (UTC)

Sorry about the style. It's just an overview and I was hoping someone would help expand it. I don't have time right now.

I think it could be longer and needs:


 * diagrams
 * code examples
 * citations

All this will make the article more formal. In particular I think it is extremely hard to get the idea without any diagrams.

Glen Pepicelli 05:42, 1 May 2006 (UTC)

Why the revert?
Glen Pepicelli, I hadn't considered my changes controversial. I think that it's obvious in a section called "Pros" in an article about bitboards that you're describing the advantages of bitboards, so I removed the redundancy. What was unclear in my new text? -Slamb 05:34, 15 August 2006 (UTC)

Slamb: Yeah your probably right that the wording is really bad. The word memory used twice. Lets change it to your version. User:Glen Pepicelli 04:12, 18 September 2006 (UTC) I don't know what I was looking at before, thanks.

Overemphasis of "difficutly" in using bitboards
I have been using bitboards in my chess programs and I believe this article is not professional in the display of the use of bitboards. Bitboards is not just for "extreme" optimization but it will also make implementation of some trivial things without the uncessary hassle of writing loops. For example safe mobility can be done more clearly than it can be done with arrays. Bitboards code are also easy to understand if one has atleast some experience in it. This is like comparing a guy who dosen't know anything about arrays and introduce him to arrays. Of course the learning curve is high in bitboards but writing code is actually easier with it. Some facts are also dead wrong. I just edited some text about how squares A1 will always be the least significant bit and how H8 will always be the most significant bit. Also you do not need to have your program with exactly a bitboard for each piece for each side. Fast implementatiosn can be made with more generic code like Pieces[6] and PiecesSide[2]. So if you want white knights you could do something like Pieces[N]&PiecesSide[WHITE]. If you need to use either only white or only black knights at parts of bottleneck code you can precompute them and use them on the fly. I believe a serious revision of this article is needed.

Agreed - bitboards not that difficult. You can use them in "Go" as well.

Illustration is misleading!
Sulev: Please look at the chessboard illustration in this article and explain why numbers at one side of board does not correspond with numbers at the other side? I think the artist has never seen any real board, if illustration is so weird.

And please check also if bitboard for black pawns in the same illustration is correct. In my opinion the 'FF' is in wrong place. Black pawns can never be in line 8! March 2007

Text Inside Illustration is WRONG
The illustration depicts 12 bitboards (2 each of the six types of pieces in the game: Pawn, Rook, Knight, Bishop, Queen, King). But the text says "10 boards" at 64 bits each --- which is 768 bits ... or 96 octets --- bytes. —The preceding unsigned comment was added by JimD (talk • contribs) 04:58, 3 May 2007 (UTC).

“Bitboards are extremely compact.”
No, they are not, you can store a position in a single Byte, use that for all non-pawns, you will need 16 Bytes, instead of 80 Bytes (+16 Bytes for the pawns each). And of course it can even be more compact… (I am ignoring promotion, but in most games there is no promotion, thus it could be handled as special case) --Chricho ∀ (talk) 17:53, 3 July 2011 (UTC)
 * You are correct - considering the number of bitboards needed, one for each piece's attacks or moves, and one for each space for piec es attacking that space (that's 64 boards = 4096 bits or 512 bytes), 2 for king locations, and usually others. The purpose of bitboards isn't compactness, but execution efficiency, since many loop-and-compare operations are reduced to bit (AND, OR, NOT) operations. I'll adjust the text to reflect the use. Sbalfour (talk) 16:47, 10 May 2019 (UTC)

other uses
There are a few other uses for bitboards that would fit in this article, I think. I have come across 2 papers that make use of them

http://link.springer.com/chapter/10.1007/978-3-642-32527-4_49 - to do with robotics (theres a thesis as well by the same author, but that's quite long)

Segundo, P.S., Galan, R., Matia, F., Rodriguez-Losada, D., Jimenez, A.: Efficient Search Using Bitboard Models. In: Proc. 18th IEEE Int. Conf. Tools with A.I., pp. 132–138 (2006) - to do with solving mathematical graph problems efficiently.

thankyou. — Preceding unsigned comment added by 193.117.31.2 (talk) 14:51, 30 October 2014 (UTC)

Distinction from Bit array? Merge it please
At Wikipedia, they have same definition. Except "Bitboard" defined as "commonly used in chess".

AFAIK, we don't have sources for "Bitboard", then can we merge them?

Distinction between was shown at Bit field page. Ushkin N (talk) 07:48, 28 May 2016 (UTC)
 * Bit field (single bit)
 * Bit word (aligned to Computer word)
 * Bit array (software implementation of multiple bit fields)
 * They are different topics and should remain distinct articles. It would violate WP:UNDUE to merge this content to bit array (there is too much of it in proportion to its importance to bit arrays in general) and on the other hand if it were redirected without merging then it would be useless as an explanation of the bit board programming technique (what do the bits mean?). —David Eppstein (talk) 00:36, 29 May 2016 (UTC)

Technical details elided
There are a lot of technical details omitted from the article.
 * exactly what does it mean to rotate a chessboard 45 degrees (or 135 degrees)?
 * how do you do that at the bit level? It's conceptually mapping 64 bits to 64 other bits, and therefore 64 sets of shift/AND/OR instructions will do it, but a sequence like that is likely to invalidate the whole method, because it's slow, and a loop of such instructions is way way worse
 * why is a perfect hash function a bane rather than benefit to magic bitboards? though I've not exactly read this anywhere, it's experimentally evident
 * as a practical matter, incremental update of bitboards is required, otherwise regenerating them on a per node basis makes the representation slower than mailbox; generally, you need to be very technically proficient coding bitboards, or you're better off with the short, simple, and readily optimized mailbox implementation

Sbalfour (talk) 00:14, 17 September 2019 (UTC)