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
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 (theh1
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 moveRg1-i1
is illegal. These bitwise operations were much faster than memory lookup in early programs which is why this system is so popular. – Andrew Dec 23 '13 at 23:24