Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: My miscellany of minor chess programming problems ?

Author: Daniel Shawul

Date: 01:04:40 08/27/05

Go up one level in this thread


On August 27, 2005 at 01:42:32, rasjid chan wrote:

>I am making basic changes to snailchess and have a set of things that I am
>not certain and welcomes any help.
>I use 0x88 squares.
>
>1) I dislike using large memory arrays thinking modern cpu are better in
>computing with registers than memory read/write and so this may be critical
>for nps. Is this actually outdated?
>(related - Uri mentioned many times he plans to use less global variables - just
>like in Fruit?)
   i think not using global variables is a good idea for parallel search and
to avoid bugs. Using static global variables(not external) might not be that
harmful.

>2) Related to the above, I have this:-
>
>   char pst_pawn[64] = {};
>   char flip[64] = {};
>
> I don't like char/int pst[128] because some say it swaps away many things from
> critical cache.
>
>   if (white)
>   score = pst_pawn[sq88To64(sq)];
>   else
>   score = pst_pawn[flip[sq88To64(sq)]];
>
>   I can't get a macro substitution for flip[64] - excuse my IQ.
    There is. You just have to get the rank and file of the square and
build the necessary fliped square from this. But this is just so slow.

>3) I have a max rank/file distance macro here, the best I can manage is:-
>
>  #define max_rf_distance(x, y)	max((x)-((y)&0xf0)&128? (y)-((x)&0xf0)>>4\
>     : (x)-((y)&0xf0) >>4, (x)-(y)&8? (y)-(x)&7:(x)-(y)&7)
>
>  Is there a better trick for this?
>
     No other trick. You can try a distacne[64][64] array, which might be slower
on some systems.

>4) retrieving the PV.
>   This was discussed over at the winboard forum but I am still not too clear.
>   We have :-
>   a) the pv[ply][ply] method. But  hash probe returns on exact usually make
>      the PV short. Is this superflous when there is hashing?
    You can have longer pvs if you don't use hash tables at PV nodes, if you
dont use null move at pv nodes, if you don't use other prunings at pv nodes.
But are you ready to pay its cost?

daniel

>   b) "retrieving" by the hash table method.
>      There was concern about the entries being overwritten but Vincent
>      Diepeeven said "there is a one-to-million chance.. " and he mentioned the
>      replacement scheme (probably crucial) of his but not too easy to
>      understand.
>
>      What I understand about "retrieving" means do nothing, ie in any
>      iteration, the PV is there as the bestmove from hash.
>
>      Or does "retrieving" mean something else specifically needed to be
>      done? (I am aware of IID)
>
>Best Regards
>Rasjid Chan



This page took 0.01 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.