Zach Wegner wrote:Personally I think traditional 0x88 is obsolete. You must test the square number first in order to see if its on the board, but you are in most cases going to access the contents of the square anyway to see if the square is empty. If I was going to do a mailbox approach, I'd do 12x16.
What is it 12x16?
I use 0x88 but such way that I have guards (guard pieces) in front as well as next the board array as well between the files of the board, like this:
That's a rather unconventional way of visualizing the board, but that is similar to what I describe. The difference is that your board is only 10x16. If there were no knights, your approach would be fine. But correct me if I'm wrong, knights on the A and H files would jump to squares off the board were it not for the 0x88 test. Adding another 16-rank file on each side allows you to bypass the 0x88 test altogether.
Zach Wegner wrote:That's a rather unconventional way of visualizing the board, but that is similar to what I describe. The difference is that your board is only 10x16. If there were no knights, your approach would be fine. But correct me if I'm wrong, knights on the A and H files would jump to squares off the board were it not for the 0x88 test. Adding another 16-rank file on each side allows you to bypass the 0x88 test altogether.
I am affraid my visualisation was not exact enough ...
Basically it is one large area of guards (in fact I have more than 16, just to be sure ) and then 8 bytes board, 8 bytes guards, 8 bytes board and so on and after that another large area of guards.
At least it is the way I think of it. I really dont know whether it is 10x16 or what however I don't see any 10 there .... It takes 120 bytes without outer guards and indexes are the same like in 0x88.
And anyway for move generation I use bitboards but knights works fine here.
Zach Wegner wrote:Personally I think traditional 0x88 is obsolete. You must test the square number first in order to see if its on the board, but you are in most cases going to access the contents of the square anyway to see if the square is empty. If I was going to do a mailbox approach, I'd do 12x16.
If that were the only benefit I agree. But the ability to ask "are these two squares on the same diagonal" and get an answer that does not break due to wrap-around is a plus for attack detection.
Read again. 12x16 you can do that too. It's just 0x88 plus two extra ranks (or files, if you're like Filip ) on the top and bottom of the board so that square coordinates don't have to be tested first before the board is accessed. Having 15 or more files allows the direction test as well.
tvrzsky wrote:I am affraid my visualisation was not exact enough ...
Basically it is one large area of guards (in fact I have more than 16, just to be sure ) and then 8 bytes board, 8 bytes guards, 8 bytes board and so on and after that another large area of guards.
At least it is the way I think of it. I really dont know whether it is 10x16 or what however I don't see any 10 there .... It takes 120 bytes without outer guards and indexes are the same like in 0x88.
And anyway for move generation I use bitboards but knights works fine here.
OK, if you have more than 16 guard squares then you are OK (specifically 25, if my head is counting correctly). Bitboards and an Xx16 board is an interesting combination. I used to use bitboards + 0x88, but got rid of the 0x88, as it wasn't being used. What do you use it for?
tvrzsky wrote:I am affraid my visualisation was not exact enough ...
Basically it is one large area of guards (in fact I have more than 16, just to be sure ) and then 8 bytes board, 8 bytes guards, 8 bytes board and so on and after that another large area of guards.
At least it is the way I think of it. I really dont know whether it is 10x16 or what however I don't see any 10 there .... It takes 120 bytes without outer guards and indexes are the same like in 0x88.
And anyway for move generation I use bitboards but knights works fine here.
OK, if you have more than 16 guard squares then you are OK (specifically 25, if my head is counting correctly). Bitboards and an Xx16 board is an interesting combination. I used to use bitboards + 0x88, but got rid of the 0x88, as it wasn't being used. What do you use it for?
Mostly in evaluation but generally elsewhere, even my move generator is a combination of bitboards and ?XxXX? (I always used to think about it beeing an ordinary 0x88, so let's call it just sliding). Bitboards for generating of moves, sliding for checking for legality (I have legal moves generator). Sliding for checking whether the move was a check though I have almost got rid of it recently because I detect check possibilities during the move generation now (with an exception of check replies). Some tasks are simplier for me to solve using bitboards, some not. Frankly speaking I am not able to imagine doing things solely with bitboards. And I am 32bit only so there is some performance penalty with bitboards.
P. S. The most important feature of 0x88 for me is what has been mentioned by Bob, namely questions about geometry of board (differences of square indexes are constant).
The pieces have negative values for the black side and in order to cope with that I'm using color-dependent code for move generation. So I only need to check if a certain square <= 0 and I know that I can move/capture with a white piece on that square.
For the black side you would have to check on the target-square for a value >= 0 and that the square is not off the board.
I don't claim this is a good idea or an efficient way to do that and having two different routines doing the same thing isn't exactly clever but I'm doing it anyway.