Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: To Recurse or not to Recurse...

Author: Robert Hyatt

Date: 06:00:44 10/31/00

Go up one level in this thread


On October 31, 2000 at 08:30:04, Steve Maughan wrote:

>In my chess program I use recursion to carry out the basic alpha beta search.
>However while on one of the Delphi newsgroup I was told that recursion is a
>source of significant inefficiency and that _ALL_ recursive algorithms can be
>converted into an iterative form that is generally faster.  Upon searching the
>net I found this site:
>

I would ignore that advice.  C compilers are really good at recursion, and
it doesn't require malloc()/free() calls to handle.  The pros are that you
can use negamax in an intuitive way, you end up with smaller code, and you
have fewer bugs.  The iterative approach is probably better for parallel
search, because it exposes _all_ the data for all the plies to you, no matter
where you are in the tree, rather than hiding it on the stack where you can't
get to it.  But then everything becomes indexed, which takes more instructions
to handle and the code becomes less readable.

I use recursion in Crafty, I used iterative code in Cray Blitz (It was written
before Fortran allowed recursive calls).




>http://www.geocities.com/zabrodskyvlada/aat/a_recu.html
>
>This basically shows that the recursive version of a sort runs at half the speed
>of the alternative version.  Moreover, thinking back I remember that Ed Schroder
>mentioned that he doesn't use recursion.
>
>How many people do use recusion?

I would bet most do, unless they use assembly language.  There they likely
would use iteration.

>
>Is there any literature on non recursive alpha / beta?
>
>Has anyone done any comparisons between recursive and none recursive searches?
>
>Regards,
>
>Steve



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.