Fritz Reul wrote:Is it necessary to use an iterative search environment in order to perform YBWC or are classical alpha-beta-recursions better?
My first test results with a simple iterative perft-iteration are not very good. The iteration works well but not very fast. I need much labels and gotos - looks ugly
What are your options?
Hi,
I haven't experimented with parallel search (yet, maybe) but I do have something else then a recursive alpha-beta function in my program, and I don't need labels and goto's. (but I do need a conditional loop.)
In some sort of pseudo Pascal:
- Code: Select all
variables : NumberOfMoves , AtMoveNumber : array[1..maxtreedepth] of Integer;
DoNextMove : array[1..maxtreedepth] of Boolean;
SearchTreeStart , InTreePlyCounter : Integer;
SearchTreeEnd : Boolean;
{root}
NumberOfMoves[1]:=Generatemoves;
AtMoveNumber[1]:=0;
DoNextMove[1]:=False;
SearchTreeStart:=2;
NumberOfMoves[2..maxtreedepth]:=0;
AtMoveNumber[2..maxtreedepth]:=NumberOfMoves+1;
{iterate over searchtree once}
SearchTreeEnd:=False;
InTreePlyCounter:=SearchTreeStart;
Repeat
If AtMoveNumber[InTreePlyCounter] > NumberOfMoves[InTreePlyCounter] then
Begin
MakeMove ( InTreePlyCounter-1 ) ; {Make move on previous depth in the searchtree}
NumberOfMoves[InTreePlyCounter]:=Generatemoves;
DoNextMove[InTreePlyCounter]:=False;
If HaveALegalMove then AtMoveNumber[InTreePlyCounter]:=0
Else AtMoveNumber[InTreePlyCounter]:=NumberOfMoves[InTreePlyCounter]+1;
end;
If DoNextMove[InTreePlyCounter] = True then
Begin
Inc ( AtMoveNumber[InTreePlyCounter] ) ;
DoNextMove[InTreePlyCounter]:=False;
end;
If AtMoveNumber[InTreePlyCounter] > NumberOfMoves[InTreePlyCounter] then
Begin
DoNextMove[InTreePlyCounter-1]:=True;
SearchTreeStart:=InTreePlyCounter-1;
SearchTreeEnd:=True;
MinimaxValueUp;
end;
Inc ( InTreePlyCounter );
Until SearchTreeEnd=True;
I have the iteration in another Repeat - Until loop that iterates over the tree a certain amount of times/nodes or the root is done or something else happened before checking for the time or update anything else.
I don't know how fast this is compared to other structures, but hope it's helpfull.
Stan