is there a 10x8 equivalent of 0x88

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

is there a 10x8 equivalent of 0x88

Post by PK »

because of the release of Winboard_F I begin to think about writing a program capable of playing 10x8 chess variants. My current toy uses 0x88 technique for move generation.

I'd like to knowe if there is a 10x8 equivalent of 0x88 technique?

regards,

pawel koziol
Aleks Peshkov
Posts: 892
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia

Re: is there a 10x8 equivalent of 0x88

Post by Aleks Peshkov »

You may use 14x16(16x16) board with board frame similar to known 12x16(16x16) if you rotate 10x8 to 8x10 coordinates.
User avatar
Zach Wegner
Posts: 1922
Joined: Thu Mar 09, 2006 12:51 am
Location: Earth

Re: is there a 10x8 equivalent of 0x88

Post by Zach Wegner »

PK wrote:because of the release of Winboard_F I begin to think about writing a program capable of playing 10x8 chess variants. My current toy uses 0x88 technique for move generation.

I'd like to knowe if there is a 10x8 equivalent of 0x88 technique?

regards,

pawel koziol
Nothing completely equivalent, because the number of files is not a power of 2. The closest I can think of is putting the board sideways, having the bit pattern of a square like this: ffff0rrr. Then you would have to do a test like this: ((sq & 0x08) || (sq & 0xA) == 0xA). I'd recommend just using mailbox with this rotated board and 16 ranks in order to use the unique difference rule.
GothicChessInventor

Re: is there a 10x8 equivalent of 0x88

Post by GothicChessInventor »

PK wrote:because of the release of Winboard_F I begin to think about writing a program capable of playing 10x8 chess variants. My current toy uses 0x88 technique for move generation.

I'd like to knowe if there is a 10x8 equivalent of 0x88 technique?

regards,

pawel koziol
We use the same technique in Crafty just applied to an 80-square board. If you change all of the 256-based references to 1024-based, then adjust all of the index matrices for rotated bitboard lookups, you are halfway there.
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: is there a 10x8 equivalent of 0x88

Post by hgm »

Pure 0x88 is needlessly slow anyway. The fastest mailbox technique to represent an NxM board is a (2N+1)x(M+4) board, filling the 'virtual' part of the board with guard pieces that test positive for both colors, and thus block any move that goes over the edge without the need for any dedicated testing for this condition at all.
mageofmaple

Re: is there a 10x8 equivalent of 0x88

Post by mageofmaple »

For an alternate method, you can see an example of bitboard move generation for the 10x8 board in the source code for ChessV (http://www.chessv.com).

The class BitBoard96 supports bitboard functions for any board with 96 squares or less (but for boards with 64 squares or less, you should use the BitBoard64 class instead.)

To see the code for move generation, see the functions GenerateMoves and GenerateCaptures in the CapablancaGame class (in the directory Games/10x8.)

Feel free to ask me if you have any questions about how it works.

Greg
rjgibert
Posts: 317
Joined: Mon Jun 26, 2006 9:44 am

Re: is there a 10x8 equivalent of 0x88

Post by rjgibert »

I was in the process of writing a longer post saying about the same thing, but now I don't think I will bother.

BTW, doesn't (2N - 1)x(M + 4) also work? Or is there some particular reason for using the (2N + 1) dimension instead?
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: is there a 10x8 equivalent of 0x88

Post by hgm »

rjgibert wrote:I was in the process of writing a longer post saying about the same thing, but now I don't think I will bother.

BTW, doesn't (2N - 1)x(M + 4) also work? Or is there some particular reason for using the (2N + 1) dimension instead?
Yes indeed, I am afraid the + was a typo. :oops:

2N-1 is the minimum needed to get unambiguous vectors from the difference between two on-board squares. For an 8x8 board in practice I use 12x16 (compatible with 0x88), i.e. 2N, for the ease of extracting file from the square number (to have easy tests for edge Pawns). The M+4 is determined by the largest stide a piece can have. In FIDE chess that is the Knight, that can do 2 ranks at a time. With Camels or Zebras on the board you would need M+6.
rjgibert
Posts: 317
Joined: Mon Jun 26, 2006 9:44 am

Re: is there a 10x8 equivalent of 0x88

Post by rjgibert »

hgm wrote:For an 8x8 board in practice I use 12x16 (compatible with 0x88), i.e. 2N, for the ease of extracting file from the square number (to have easy tests for edge Pawns).
When you do this, you are making a trade off. With 2N - 1 guaranteed to be an odd number, it is then simpler and faster to determine whether a given square is white or black i.e. sq&1 works. Wouldn't this be the more useful of the 2 operations?
PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: is there a 10x8 equivalent of 0x88

Post by PK »

Thanks all of You!

Unfortunately I don't feel up to writing a bitboard program yet, and what's more I'm handicapped by using Delphi, so C programs are not too helpful for me. That is, I can read (rather stammer) through them, and it's not enough to get the feel of bitboards.

So it's either mailbox or corrupted 0x88 in the form of 0x08 together with 0x0A.

By the way: hgm, I always thought that the whole point of 0x88 is not to read any table to check if we are already outside the board. can You tell me why it's slower? After all in exchange for a couple of xors (for a Rook averaging to 4, for a Bishop to 3 point something) You save one table lookup. But You are probably right, since Joker beats Hopeless. :cry: