Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How to remember the principle variation in my program

Author: Tord Romstad

Date: 05:47:05 08/26/03

Go up one level in this thread


On August 26, 2003 at 07:36:53, Hans Bogaards wrote:

>On August 26, 2003 at 06:28:13, Tord Romstad wrote:
>
>>>In my old program I first used a 2 dimensional array PV[MAXDEPTH][MAXDEPTH]
>>>and stored the best move in PV[Depth][Depth] and copied the rest of the PV
>>>from PV[Depth + ][Depth + X] to PV[Depth][Depth + 1]. This worked but was
>>>very slow.
>>
>>This is what most people do, I think.  And there is no reason it should be
>>slow.
>
>The approach with the linked list was about 10% quicker, IIRC.

Do you mean that your whole program was 10% quicker with the linked list
approach, or that updating the PV was 10% quicker?  If you mean the former
(and I guess you do), I am very suprised that the difference is so big,
even if you copied al moves from Depth+1 to MAXDEPTH.

But anyway, I think it is a good idea to just choose some approach which
works well, and simply forget about the speed.  I can almost guarantee that
the relative amount of time spent updating your PV will decrease
dramatically when you improve other parts of the program.  This is partly
because your eval will eventually grow bigger and more time-consuming
until the amount of time spent updating the PV (and everything else you
do in your search() function) will be neglible, and partly because your
move ordering will improve, which means that you will have to update
the PV much less often.

In general, you should probably not worry much about speed before you
have a working and reasonably strong program.  The bottlenecks will
probably be at entirely different places in your code at the time your
program is close to finished.

>>The code should look something like this:
>>
>>PV[Depth][Depth] = new_best_move;
>>for(i = Depth+1; i < PV_length[Depth+1]; i++)
>>  PV[Depth][i] = PV[Depth+1][i];
>>PV_length[Depth] = PV_length[Depth+1];
>>
>>I assume this is what you did?  I cannot imagine how this could slow down
>>a program noticably ...
>
>I'll try this approach again. I think that the problem was that I copied all
>moves from Depth+1 to MAXDEPTH instead of PV_length.

Perhaps.  Of course, it is not really necessary to have a separate
PV_length[] array.  You can also have some kind of "dummy move" which
simply tells you have reached the end of the PV.

>>Good luck with your program!  I would recommend you to make it compatible
>>to the xboard/Winboard protocol.  There is a big community of friendly
>>Winboard enthusiasts who runs test tournaments between amateur engines
>>of all strengths.
>
>That is my plan. I might also implement the UCI protocol

Yes, it is nice to have both (I have implemented both in my own program).
When you have already working xboard support, UCI should be just a couple
of hours of work.

>If I ever manage to make a version of my program that is stable enough for
>release and plays reasonable chess, I'll let you all know...
>
>Before that I will probably need to ask many more questions.

Feel free to do so!  You may also be interested in the Winboard Forum,
where many of the other amateur chess programmers hang out:

http://f11.parsimony.net/forum16635/index.htm

Tord



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.