# Why is a 0x88 chessboard array of size 128 bytes when 0x88 is decimal 136?

I am starting to look at chessboard representation with the 0x88 hex array board rep, but I'm getting confused! Please help me understand it properly!

The 0x88 chess board representations I have seen as examples around on net resources say it can be thought of as representing a 16x8 2D array (size 128 and so is used as 2 boards side by side to check off board moves etc).

However, afaik, hex value 0x88 is equivalent to 136 in decimal (10001000 in binary) so why is the array size not size 136 (136 bytes)? I must be overlooking something simple with this. I apologise for this and will no doubt feel very foolish when I find what mistaken thinking my brain is stuck with over this!

I am grateful for any helpful replies,many thanks

0x88 is just the name of the system. The actual length of the board array is 128.

The name comes from the fact that a bitwise AND can be performed the index of a square (range is 0 to 127) and 0x88. If the result is non-zero, then the square is not on the board. This happens because 0x88 is `10001000` in binary and every square on the board will have the form `0xxx0xxx`.

Another benefit of the system is that all of the legal squares can be trivially constructed in octal notation. For example, `d4` is `0x33` assuming that 0x00 is the lower left of the board (both d and 4 are the 4th square from the edge, so 3 in a zero-indexed array).

• @rpd As an example, consider finding all of the moves to the right for a rook on `g1`. That square is 0x06. To get to the next square, we add 1: 0x07. Then we test to see if it's on the board (0x88 & 0x07 => 0). Since that is zero, it's on the board (the `h1` square). Repeat: 0x08 is the next square (`i1`) and the bitmask is as follows: 0x08 & 0x88 => 0x08. Since that is non-zero, the square is off the board and the move `Rg1-i1` is illegal. These bitwise operations were much faster than memory lookup in early programs which is why this system is so popular.