Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: JRCP on fics

Author: David Eppstein

Date: 22:22:11 02/19/99

Go up one level in this thread


On February 20, 1999 at 00:58:59, Will Singleton wrote:
> You aren't doing mallocs within the search, are you?

It's actually possible to get away with mallocs in the search, if you reuse the
malloced nodes rather than freeing them and latter mallocing them again.

I'm not sure I would do it this way again, but my program has an allocated
struct per search node, with two pointers: one to the child that's being
searched and one to the first move in the PV.  The PV pointers form a linked
list that gives me the whole PV; the objects in that list have empty child
pointers.

When a node (x) has a child (y) that lands inside the alpha-beta window, I set
the new PV simply by something like
   x.child = x.pv
   x.pv = y
   x.child.child = y.child
   y.child = null
Since I use negascout, this happens very infrequently, but it wouldn't be very
slow even if it happened more often.

Even less frequently, a child pointer is null and I have to allocate a new one.
The total number of nodes in all of this linked structure is O(depth^2) so this
doesn't slow me down much.



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.