Bitboards and a 10x8 board

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Matthias Gemuh
Posts: 3245
Joined: Thu Mar 09, 2006 9:10 am

Bitboards and a 10x8 board

Post by Matthias Gemuh »

I thought I could simply modify a few things in my engine to have it play
Capablanca 10x8 chess but it seems impossible because my engine heavily relys
on bitboards.
My compiler knows an 80-bit data type (long double) but can I use bit
operations like & ^ | << >> on this data type ? The MSB (Bit 79) is a
troublesome sign bit, right ?

Matthias.
My engine was quite strong till I added knowledge to it.
http://www.chess.hylogic.de
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Bitboards and a 10x8 board

Post by hgm »

The 80-bit data type is only used by the old x87-style FPU instructions. These are all pure floating-point operations, none of the operators you mention is amongst them.
Carey
Posts: 313
Joined: Wed Mar 08, 2006 8:18 pm

Re: Bitboards and a 10x8 board

Post by Carey »

Like HGM says, the 80 bit type is only floating point. Although some of it can be used to hold data, it has a number of reserved bit pattersn (Not A Number, INF, etc.) that make it unsuitable to actually use, or even as a way to copy data from one location to another.

You'll have to create your own data type.

Most in here will probably recommend using C++ to create classes with overloaded operators that allow you to use familiar shift operators, but that's quite a bit of work. And all it does is hide some of the syntax. The actual mechanics are no different than a more simple approach of using inline functions.

You'll have to use a structure to create an 80 bit data type, and then write explicit functions to operate on those types.

It's not really all that difficult, but it is a little tedious and ugly.

The performance wont be too bad if you can code things right. Most will be able to compile inline into a few AND/OR operations. Shifting will be a little ugly, but then so is 64 bit operations on a 32 bit system.

Creating your own 64 bit (or 80 bit, in your case) data type is pretty common.

Even the original Slate & Atkin CHESS program in the 70s had to create a 64 bit data type on a machine that only had 60 bit registers.

Larry Atkin wrote Chess 0.5 in Pascal in 1978 for 8 bit micro's. As you can expect he had to create his own 64 bit data type. Although much of the ugliness in that is due to Pascal rather than the artificial data type.


Anyway, you'll end up with code that runs tolerably well, but it wont be the prettiest. It'll be about like doing 64 bit bitboards on a 32 bit cpu.

The real benefit comes from representing chess ideas etc. as bitboards, not the actual performance of the bitboards themselves.
Aleks Peshkov
Posts: 892
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia

Re: Bitboards and a 10x8 board

Post by Aleks Peshkov »

There are several online documents about bitboard implementation of Shogi 9x9 board.