Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Why is a triangular array needed to store the PV?

Author: Uri Blass

Date: 16:12:36 04/28/02

Go up one level in this thread


On April 28, 2002 at 17:05:59, Odd Gunnar Malin wrote:

>On April 28, 2002 at 16:26:18, Russell Reagan wrote:
>
>>I'm curious why a triangular array is needed when storing the PV. What is wrong
>>with having a regular array that stores the PV? In other words...
>>
>>move pv[MAX_PLY][MAX_PLY]; // <--- why do we need this?
>>move pv[MAX_PLY];          // <--- instead of just this?
>>
>>Since you only use pv[0][0], pv[0][1], pv[0][2], etc. I don't see why you can't
>>use a one demensional array to store the pv in. There must be some reason
>>because when I searched the net and the CCC archives everyone explained it using
>>a triangular array, but I can't seem to figure out why this is necessary. Anyone
>>know the reasoning here?
>>
>>Russell
>
>Hi.
>
>You don't know before the search return that it would be a new PV, so you (at
>least I do) have to save PV for all rootmoves or current plus best.
>
>pv[MAX_MOVE][MAX_PLY]
>
>I can imagine that other do it different :)

Yes
Other do it different and I also found it as something that is not very easy to
understand.

I will try to give some explaination.

The idea of the triangular array is not to save pv for every root move but to
save every line that is candidate to be a pv.

you update the pv array every time that the score is above alpha but less than
beta.

If the score is at least beta then it means that one side could play better and
if the score is at most alpha it means that the second side could play better so
both cases cannot be in the pv.
If the score is between alpha and beta then the line is candidate to be the pv.

The search of chess programs search a lot of illogical lines so we need to
remember the latest candidate to be a pv at every depth because it is possible
that this candidate is going to be relevant in the next time that we take back
moves.

Uri



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