Move ordering help

Discussion of chess software programming and technical issues.

Moderator: Ras

Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Move ordering help

Post by Sven »

Richard Allbert wrote:Also, if I add PVS

Code: Select all

        val = -alphabeta(-alpha-1, -alpha, depth-1+ext, true, check);
        if ((val > alpha) && (val < beta))
        {
            stats->pvsresearch++;
            val = -alphabeta( -beta, -alpha, depth-1+ext, true, check);
        }
Then the node count increases, rather than an expected decrease.
[...]
So the problem could well be the PVS implementation... sorry. :?
As far as I can see from your previous posts you are using fail-hard alpha-beta. So I am not sure whether your re-search condition "val > alpha && val < beta" is correct, IMO it should be "val > alpha" only. But it is possible that this is only redundant code since "val > alpha" after null-window search should mean "val == alpha+1".

Sven
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Move ordering help

Post by Sven »

Sven Schüle wrote:
Richard Allbert wrote:Also, if I add PVS

Code: Select all

        val = -alphabeta(-alpha-1, -alpha, depth-1+ext, true, check);
        if ((val > alpha) && (val < beta))
        {
            stats->pvsresearch++;
            val = -alphabeta( -beta, -alpha, depth-1+ext, true, check);
        }
Then the node count increases, rather than an expected decrease.
[...]
So the problem could well be the PVS implementation... sorry. :?
As far as I can see from your previous posts you are using fail-hard alpha-beta. So I am not sure whether your re-search condition "val > alpha && val < beta" is correct, IMO it should be "val > alpha" only. But it is possible that this is only redundant code since "val > alpha" after null-window search should mean "val == alpha+1".

Sven
I think the "&& val < beta" is OK, sorry for confusing you. There was a discussion last year where that has been asked already, see the "PVS" thread in this forum that just popped up again today.

Sven
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Move ordering help

Post by Sven »

Richard Allbert wrote:Also, if I add PVS

Code: Select all

    int played=0;

    for(uint i = 0; i < mlist.getcount(game.getply()); ++i)
    {
        picknext(i,mlist);

        if (makemove(game,mat,his,list[i]))
        {
            takemove(game,mat,his);
            continue;
        }

        check = incheck(game,mat,game.getside());
        ext = 0;
        if(check)
        {
            stats->checkext++;
            ext = 1;
        }

        if (played==0 && opt->pvs)
        {
            stats->pvssearch++;
            val = -alphabeta(-alpha-1, -alpha, depth-1+ext, true, check);
            if ((val > alpha) && (val < beta))
            {
                stats->pvsresearch++;
                val = -alphabeta( -beta, -alpha, depth-1+ext, true, check);
            }
        }

        takemove(game,mat,his);
        if(status->stopped == STOPPED)
        {
            return 0;
        }

        played++;

        from = FROM(list[i]);

        if (val > alpha)
        {
            // ..etc
This PVS implementation is flawed IMO. You do a zero-width search and possibly a re-search if played == 0, i.e. for the first move? That does not make sense for me. Can you explain whether this is a bug or a feature?

And what about your search for played > 0, then?

Sven
Richard Allbert
Posts: 794
Joined: Wed Jul 19, 2006 9:58 am

Re: Move ordering help

Post by Richard Allbert »

Hi Sven,

Thanks for the move ordering tips... I'll try them out.

Regarding PVS.. you are correct, but I seem to have deleted a couple of lines by mistake, when editing some other things out.

Code: Select all

if (opt->pvs)
     {
        if( played == 0)
        {
         val = -alphabeta( -beta, -alpha, depth-1+ext, true, check);
        }
        else
        {
         val = -alphabeta(-alpha-1, -alpha, depth-1+ext, true, check);
         stats->pvssearch++;
         if (val > alpha)
         {
            stats->pvsresearch++;
            val = -alphabeta( -beta, -alpha, depth-1+ext, true, check);
         }
        }
     }
     else
     {
       val = -alphabeta( -beta, -alpha, depth-1+ext, true, check);
     }

     takemove(game,mat,his);
     if(status->stopped == STOPPED) { return 0;}

     played++;
Sorry.

Anyhow, I was looking at the PVS, and thinking... I should really do root move ordering for this to have a positive effect, shouldn't I?

Thanks

Richard[/code]
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Move ordering help

Post by Sven »

Richard Allbert wrote:Regarding PVS.. you are correct, but I seem to have deleted a couple of lines by mistake, when editing some other things out.
Looks better now :D

Sven
Harald
Posts: 318
Joined: Thu Mar 09, 2006 1:07 am

Re: Move ordering help

Post by Harald »

Spacious_Mind wrote:Quick side topic. Do you still have your chess program available for Atari ST ? If so I wouldn't mind checking it out.
I can offer the source and TOS Program of my first chess program
"HLSchach" on the Atari ST. This program was never publicly released
for a good reason. It looked nice but was extremely slow. In a few minutes
it could only reach ply 4 to 6. The move ordering for the alpha beta
algorithm was just awful. The language of the program is C. I can not
promise that the last version I found in my "old Atari" folder works
without problems.

Send me an email address to get it (400kB zip).

Harald