Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Question:1.hashtable 2.board 3.C

Author: Christophe Theron

Date: 12:55:31 06/14/00

Go up one level in this thread


On June 14, 2000 at 07:35:47, Rémi Coulom wrote:

>On June 14, 2000 at 06:55:08, Christophe Theron wrote:
>
>>On June 14, 2000 at 03:03:22, Peter Kappler wrote:
>>
>>>On June 13, 2000 at 23:10:51, Christophe Theron wrote:
>>>
>>>>On June 13, 2000 at 17:06:57, Tom Kerrigan wrote:
>>>>
>>>>>On June 13, 2000 at 16:10:05, Christophe Theron wrote:
>>>>>
>>>>>>With the other approach, you need a table lookup to tell that the square is not
>>>>>>inside the board:
>>>>>>
>>>>>>  // 12x12 way:
>>>>>>  if (board[square]==-1) it_is_outside;
>>>>>>  else                   it_is_inside;
>>>>>
>>>>>If your board starts out being 12x12, then you're right, it doesn't really make
>>>>>a difference if you switch to 0x88.
>>>>>
>>>>>However, I know that a number of programs use an 8x8 board. To do the bounds
>>>>>testing, they convert the 8x8 offset into a 10x12 offset and then back again.
>>>>>You can see this done in TSCP. This method is obviously a loser compared to
>>>>>0x88.
>>>>
>>>>
>>>>I don't really understand why you would use a 8x8 board if you use 12x12
>>>>coordinates or the opposite...
>>>>
>>>>Actually I'm using 16x16 coordinates, so I shouldn't have mentionned 12x12 or
>>>>12x10, but just 16x16 (well actually I just need 16x12).
>>>>
>>>>I think 16x16 is more efficient than 0x88 and I explained why. And it is much
>>>>simpler to understand than 0x88 BTW! The way you test the out of bound condition
>>>>in 0x88 is great, but that's the only advantage of this system, and as I
>>>>explained nobody cares for this test most of the time!
>>>>
>>>>
>>>>    Christophe
>>>
>>>
>>>What makes 16x12 better than 12x12?  I'm sure it allows for some clever bitwise
>>>operations somewhere, but I don't quite get it...
>>>
>>>--Peter
>>
>>
>>You are right, there are a lot of smart things to do with 16x16 (or 16x12). For
>>example knowing easily if a square is a corner, in the center, and a lot of
>>other nice stuffs.
>>
>>
>>    Christophe
>
>I use 0x88 in TCB and I almost never do the & 0x88 trick. I think that the most
>important advantage of 0x88 over 12x12 or 10x12 is that you can use the
>difference between two squares to detect their relative positions (and test for
>attacks, etc.). I guess this is also why 16x12 is better than 10x12 or 12x12.
>16x16 or 16x12 seem much closer to 0x88 since 0x88 is actually 16x8.
>
>Remi


That's right. When I say "0x88" I have in mind the way squares are coded, which
mainly helps to have:
1) smaller arrays
2) an elegant way to test the "out of the board" condition

I think these are the main advantages of 0x88, but as I said these advantages
are just an illusion.

16x16 or 16x12 looks like 0x88, but
1) square coding is different and does not allow very small arrays
2) you test the "out of board" condition by actually accessing the content of
the board (which has no adverse effect on performances)
3) it is possible to very quickly say if a square is on the edge of the board,
in the corner, in the center, and so on...

Both 0x88 and 16x16 allow vector calculations.


    Christophe



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.