Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: advantages to board pointers

Author: Dann Corbit

Date: 13:33:03 06/10/04

Go up one level in this thread


On June 10, 2004 at 16:26:01, Eric Oldre wrote:

>I've decided to stop development on the vb.net version of my engine (Murderhole)
>in order to focus on a new version written in C that has a chance to be
>competitive eventually. (eventually=hopefully in my lifetime)
>
>Considering that a large chuck of the code I’ve ever written in C has had the
>words "Hello" and "World" in it, this could end up being quite a process for me.
>However I feel pretty good since after a few nights I now have methods for
>fenset, fenget, move_make, reset_board, as well as functions to get ranks from
>positions etc.
>
>In the VB.net version of my engine I ended up having 1 global board, And I’ve
>began to program my new engine the same way.
>
>Reading the Crafty source, I see that Mr. Hyatt is passing around pointers to
>some object that (among other things) has a board position type struct. (I’m not
>sure of the details, don't have the source in front of me).
>
>I'm guessing that he needs to pass this tree around to so that crafty can take
>advantage of multiple processors. I.e., each thread is going to need its own
>version of the board to pass around.
>
>My questions are:
>1) Am I right that the pointers to the board are used so that crafty can use
>multiple processors? Would there be a way to use multiple processors without
>this technique or something similar?
>
>2) What other advantages would there be to passing the pointers to the tree? (if
>any). It would seem to me to cause some performance hit on single processors.
>
>3) What other advice or experience would other authors like to give me
>concerning this architecture decision?
>
>4) So far I've been studying the source to crafty, tscp, and gerbil. Anyone have
>examples of other engines that I could study to get a handle on some of the
>different techniques used?
>
>Thanks,
>Eric Oldre
>
>http://www.oldre.com/Murderhole
>
>PS... I'm not going to be at home tonight, so i may not be able to respond to
>any answers right away.

There are two reasons you might want to use pointers:

1.  You don't know how big something will be before hand.  E.g. a hash table.

2.  You want to pass it as quickly as possible and the pointer is smaller than
the object.  For instance, if I have a 500 byte object and a pointer is 4 bytes,
then passing a pointer will push and copy 4 bytes {the address of the object}
instead of 500 bytes {the object itself}.

The functionality of things does not hinge on whether you have the object or a
pointer to it.



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.