Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Selecting the best board representation (excluding bitboards)

Author: Dave Gomboc

Date: 16:48:49 11/10/99

Go up one level in this thread


On November 10, 1999 at 04:56:44, Inmann Werner wrote:

>On November 09, 1999 at 22:29:17, Nicolas Carrasco wrote:
>
>>Dear Guys,
>>
>>I have tryed to build a move generator using a single a array faster than TSCP.
>>(I know how to increase a bit TSCP gen), and it seems that for move-generator is
>>better a pair of arrays, but I guess to know if it is the same or equal speed
>>for an eval function. I know that this depends of how you do that ,but try to
>>answer considering your experince.
>>
>>Maybe a pair of 64 int arrays is slower than a single one for eval functions
>>and/or hashing functions.
>>
>> I am asking you this in order to select the apropiate board representation for
>>a long time before going to bitboards.
>>
>>I also found an interesting board representation that uses this:
>>
>>{      0,   1,   2,   3,   4,   5,   6,   7,
>>  __,  __,  __,  __,  __,  __,  __,  __,
>>  16,  17,  18,  19,  20,  21,  22,  23,
>>  __,  __,  __,  __,  __,  __,  __,  __,
>>  32,  33,  34,  35,  36,  37,  38,  39,
>>     __,  __,  __,  __,  __,  __,  __,  __,
>>  48,  49,  50,  51,  52,  53,  54,  55,
>>     __,  __,  __,  __,  __,  __,  __,  __,
>>  64,  65,  66,  67,  68,  69,  70,  71,
>>     __,  __,  __,  __,  __,  __,  __,  __,
>>  80,  81,  82,  83,  84,  85,  86,  87,
>>     __,  __,  __,  __,  __,  __,  __,  __,
>>  96,  97,  98,  99, 100, 101, 102, 103,
>>     __,  __,  __,  __,  __,  __,  __,  __,
>> 112, 113, 114, 115, 116, 117, 118, 119 } // THE MAP TO CALCULATE THE VECTORS
>>
>>int initial_board[120]=
>>{
>>     BR,  BN,  BB,  BQ,  BK,  BB,  BN,  BR,
>>  __,  __,  __,  __,  __,  __,  __,  __,
>>  BP,  BP,  BP,  BP,  BP,  BP,  BP,  BP,
>>  __,  __,  __,  __,  __,  __,  __,  __,
>>  XX,  XX,  XX,  XX,  XX,  XX,  XX,  XX,
>>     __,  __,  __,  __,  __,  __,  __,  __,
>>  XX,  XX,  XX,  XX,  XX,  XX,  XX,  XX,
>>     __,  __,  __,  __,  __,  __,  __,  __,
>>  XX,  XX,  XX,  XX,  XX,  XX,  XX,  XX,
>>     __,  __,  __,  __,  __,  __,  __,  __,
>>  XX,  XX,  XX,  XX,  XX,  XX,  XX,  XX,
>>     __,  __,  __,  __,  __,  __,  __,  __,
>>  WP,  WP,  WP,  WP,  WP,  WP,  WP,  WP,
>>     __,  __,  __,  __,  __,  __,  __,  __,
>>  WR,  WN,  WB,  WQ,  WK,  WB,  WN,  WR
>>
>>};
>>
>>BP,WP,....,..., are number definitions :)
>>
>>the "__" are elements are not being used.
>>
>>here I skip the mailbox check doing :
>>
>>#define BOARD(z)             ((z&0x88)==0) /* To check if a position z is inside
>>the board */
>>
>>So if I put
>>gen()
>>{
>>    if(BOARD(any_position)) /// I SAVE THE MAILBOX FUNCTION
>>        THIS IS A LEGAL MOVE
>>}
>>
>>The problem that I founded here is that I have to eat 64 unused
>>elements or run an if statement to skip them, and that slows too much.
>>
>>Thanks
>
>This board representation looks funny, but not very useful IMHO.
>
>I think, the most useful representations are:
>1) BOARD signed char[64];     hope is clear... 8*8
>2) BOARD signed char[120];    10*12
>
>ad 2) (I use it, but now also with bitboards...)
>BOARD[21]=a1;BOARD[31]=a2 ........
>0 is empty, 99=not allowed, 6=White King,-6=Black King,1 =white Pawn......
>it is nice for move generating, cause i give the non used outer fields an
>impossible value (99), so you have not to check for leaving the board. Useful
>for Knights and also Q,R,B. also you have no problem to get out of the array.
>(less bugs)
>for evaluation, it is not as good, cause you can not so fast determine the row
>and line of a field. I use lookuptables, which seem to be faster than field/10
>and field%10.
>If you change to Bitboards, you always have to change a lot, but it would be
>easier to take a 8*8 cause it is closer to the bitboard.....
>
>In using two arrays, I see no win. If you use one array and say White King =6
>and Black King=-6 you can work nice.
>
>You may introduce some figure-lists. One for white and one for black, where the
>figure is in and the position. Maybe better than parse the whole board for
>figures. (Best here is Bitboards!!!)
>
>If you think of which system you use you have to think of three routines mainly
>(IMHO)
>1) move generator
>2) evaluation
>3) make-unmake move
>
>3) can get rather big and slow, if you use some strange things....., and you
>have always an exchange. Either you make evaluate slow with calculating there
>everytime everything new, or you make "make-unmake move" slow by calculating
>there "on the fly" (IMHO most time second is better).
>Make-unmake move at the beginning of my programming was the most growing
>routine, as calculating hash, something with pawn structure......
>
>hope it helps
>
>Werner
>
>P.S: If you find something useful in your above board representation (120 fields
>with emty lines) let me know!

From a quick glance, the board rep was 0x88, which is pretty popular.

Dave



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.