LMR implementation

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

LMR implementation

Postby Manuel Peña » 08 Feb 2008, 10:11

Can you take a look to my LMR implementation.
Sems ok?


alfabeta (int alfa,int beta,int depth,int ply,int tipe)
{
nmov=0;
...

mov(tree[i]);
nmov++;
if ((nmov>=5)&&(ply>=3)&&(!(tipe&CHECK)))
{
ev=-alfabeta(-alfa-1,-alfa,depth-2,ply+1,tipe);
if ((ev>-beta)&&(ev<-alfa)) ev=-alfabeta( -beta,-alfa,depth-1,ply+1,tipe);
}
else ev=-alfabeta(-beta,-alfa,depth-1,ply+1,tipe);
unmov();

...
}

Manuel Peña
 
Posts: 15
Joined: 28 Jan 2008, 14:06

Re: LMR implementation

Postby Tord Romstad » 08 Feb 2008, 11:48

Hello Manuel!

Manuel Peña wrote:Can you take a look to my LMR implementation.
Sems ok?


I think there is at least one important error.

alfabeta (int alfa,int beta,int depth,int ply,int tipe)
{
nmov=0;
...

mov(tree[i]);
nmov++;
if ((nmov>=5)&&(ply>=3)&&(!(tipe&CHECK)))


You should probably add some more conditions here. In particular, reducing captures is probably too dangerous. Most of us also don't reduce passed pawn pushes.

{
ev=-alfabeta(-alfa-1,-alfa,depth-2,ply+1,tipe);
if ((ev>-beta)&&(ev<-alfa)) ev=-alfabeta( -beta,-alfa,depth-1,ply+1,tipe);
}
else ev=-alfabeta(-beta,-alfa,depth-1,ply+1,tipe);
unmov();


...
}

The line with "if ((ev>-beta)&&(ev<-alfa))..." looks very strange. Comparing ev to -beta and -alfa makes no sense. I am not sure how you were thinking, but I guess you must have added an extra negation somewhere in your code.

Using "if ((ev > alfa) && (ev < beta))..." makes more sense, but is still wrong. You shouldn't allow beta cutoffs based on a reduced-depth search. I think just "if (ev > alfa)" is the correct condition to use.

Tord
User avatar
Tord Romstad
 
Posts: 639
Joined: 09 Oct 2004, 12:49
Location: Oslo, Norway

Re: LMR implementation

Postby Manuel Peña » 08 Feb 2008, 16:39

Thanks Tord
Manuel Peña
 
Posts: 15
Joined: 28 Jan 2008, 14:06


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 21 guests