Computer Chess Club Archives


Search

Terms

Messages

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

Author: Flemming Rodler

Date: 09:55:36 06/13/00

Go up one level in this thread


On June 13, 2000 at 12:18:34, TEERAPONG TOVIRAT wrote:

>Hi,
>
>I have 3 questions.
>1. Does two level transpositional table have significant
>advantages over one level table ? If so,how much we
>gain in % ?
>
>2.In board representation,besides bitboard ,which is faster
>between board 12x10(or 12x12) and board 0x88 ?
>To generate the move,after obtaining piece and location,
>the former takes one array look up and one arithmetic
>operation to get a valid square.On the other hand,the
>latter takes 2 times table look up(map and unmap)
>and one arithmetic and one bitwise operation(&0x88) .
>I think the former is better. Am I right ?
>Of course,board 0x88 can make use of (sq>>3) (sq&7) in
>evaluation(). Overall result which one is better ?
>
>3.In C language...
>{
>int a[2];
>int x,y;
>...
>if(x&8) a[1]=y;else a[0]=y; // this line
>...
>}
>
>Is it legal if I change into...
>a[x&8]=y;

This is not going to work. The expression (x&8) evaluates to either 0 or 8.
This is because 8 in binary is written as  0..0001000
                                                    ^- least significant bit.
so the & operator masks out the 4'th bit of x.
Instead you could write something like:

a[(x>>3)&1] = y;    or
a[(x&8)>>3] = y;



>I didn't get any error message from it .

The compiler can not catch errors like this. You will first experience the error
at runtime. Such errors can be really tricky to track down.

Best regards
Flemming

>Can it be a potential bug?
>
>Thanks,
>Teerapong



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.