Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: calling subroutines

Author: Robert Hyatt

Date: 14:02:05 10/05/98

Go up one level in this thread


On October 05, 1998 at 16:49:07, John Coffey wrote:

>Like most chess programs, I have a data structure that represents the current
>state of the board.  Some programs have bitboards, but instead I use information
>for each square.  My data structure could easily grow into 300 to 500 bytes.
>
>I am just now starting to write my search routines.  If I am in my routine
>"SearchForWhite()" and it tries a move and then calls "SearchForBlack()" (These
>names are hypothetical at this point) then it needs to pass the current state
>of the board to "SearchForBlack()."
>
>Question:
>
>Is it more efficient to ....
>
>1.  Only have one copy of the current state, and have "SearchForBlack()"
>restore the board back to its previous state before returning to
>"SearchforWhite()"?
>
>or
>
>2.  "SearchForWhite" passes the whole data structure on the stack as a copy of
>the original so that "SearchForBlack()" doesn't have to restore the board?
>
>John Coffey

Use one global state, and make/unmake moves.  The PC doesn't have enough
memory bandwidth to do copy/make operations.  If you are targeting some
other architecture, like the Cray, your idea is better, because the Cray has
*plenty* of bandwidth to support this.



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.