Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: rewriting alpha beta(thanks in advance for advices)

Author: Robert Hyatt

Date: 05:29:08 12/11/03

Go up one level in this thread


On December 11, 2003 at 06:44:06, Uri Blass wrote:

>I deciding that I probably need to rewrite my alphabeta function to make changes
>in the search easier to do.
>
>some questions about it:
>
>1)When do you calculate extensions

Inside the loop where I choose and make a move and then recursively
call search.  That is where I notice that the move is the only legal
move, or the move checks the opponent, or pushes a passed pawn, etc.


>Today I call alphabeta immediately after makemove and alphabeta calculate the
>extensions(I think it should be done before it).
>
>2)Another thing that I need to change is the way that I calculate extensions and
>today they are calculated in 2 varaibles when one of them is the partial
>extensions and it may be better to have one varaible.



I just use one and pass it down...  it is in units of 1/60th of a ply.


>
>3)Another thing that I consider to change is my sort function.
>
>Mine is similiar to tscp and get the number of move in the stack as a parameter
>and I remember from a post of Tord that he simply has a function to pick moves
>that does not get varaibles.
>
>Even without changing this structure I suspect that my replace between moves is
>not efficient
>
>Here is the start of my sort function.
>
>void sort(int from)
>{
>	int i=0;
>	int bs;  /* best score */
>	int bi;  /* best i */
>	gen_t g;
>	bi=from;
>	switch (phase[ply])
>	{
>	case pvnode:
>		{
>			follow_pv = 0;
>			phase[ply]=goodcapture;
>			for(i = first_move[ply]; i < first_move[ply + 1]; ++i)
>				if (gen_dat[i].m.u == pv[0][ply].u)
>				{
>					follow_pv = 1;
>					g = gen_dat[first_move[ply]];
>					gen_dat[first_move[ply]] = gen_dat[i];
>					gen_dat[i] = g;
>					break;
>				}
>				if (follow_pv)
>					break;
>		}
>
>


Why not stop the "follow PV" logic completely, and before you start
an iteration, make sure that the PV moves are in the hash table.  Then
the "hash move first" will take care of this case and you don't have
to handle it separately.



>first:
>I can do it faster by noticing that the move is illegal in part of the cases
>but it is not very important because the case of pvnode is clearly rare.
>
>I think that what I do is not efficient because when I use switch command, I
>should not start with something rare and case pvnode is clearly something rare
>but I do not know exactly how to change it at this moment to something more
>efficient.
>
>Another point is how to replace between 2 unions in an efficient way because my
>move is a union between struct of 4 chars and int.

Just assign the unions like a normal variable or structure...

>
>I remember a post of david omid about replacing between 2 ints in an efficient
>way without a third varaible but I do not know what is the best efficient way to
>do it for unions of struct of 4 chars and int.
>


 a struct of 4 chars is the same as an int...



>Uri



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.