Author: Don Dailey
Date: 11:47:22 10/06/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 It is not clear and may depend on many factors. I have written many chess programs both ways. In my experience, it is remarkably cheap to throw away the un_make() routine and use method 2. But it may depend heavily on how much state is involved and the particulars of your architecture. When my program runs on an intel, it is slow. When it runs on an Alpha it is fast. Comparing to Crafty, my program runs MUCH slower than Crafty on an intel and 20% or 30% faster than Crafty on our particular Alpha machine in nodes per second. But I doubt the extra speed of cilkchess (on an Alpha) has anything to do with this, I think Crafty simply spends more time in the evaluator than Cilkchess does. My suggestion is to implement both. Put the search state in a single structure, use method 2 and get it debugged. Then add a move un-maker and you have the option to use either! You may find that certain computers like one over the other. The bottom line in my opinion is that it may not make a lot of difference either way, but I cannot say this for sure. Each program may respond differently. I find the state copying stuff a lot nicer to work with however. It is better and cleaner from a purist point of view (which I'm not.) Also, your program can be ported much easier to a parallel machine when the time comes if you throw away the global stuff. This is because you can save positions convienently and just pass them to another processor when needed. - Don
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.