Author: Leen Ammeraal
Date: 12:09:51 07/12/01
Go up one level in this thread
On July 12, 2001 at 07:16:43, Steve Maughan wrote: >Leen, > >Do you sort the tables att[] amd def[]? I ask since I cannot see a loop in the >SEE routine. If there is no ordering it is possible that the scores returned >are incorrect e.g. it may be profitable to take with a Bishop but not a Queen >since the piece is defended by a Rook. > >Am I missing something? > >Regards, > >Steve Maughan > > Yes, but sorting is done before this function 'gain' is called. The original question (I forgot from whom) was about when to stop in a swapoff sequence. So I only dealt with the subproblem of how to compute the score once we have lists of attackers and defenders. Before I call 'gain', I construct these two lists, and I then sort. Of course you cannot always use lighter pieces first, for example with a queen on b2 and a bishop on a1 attacking, for example, a piece on d4, so this sorting is rather tricky. As for your question about a loop, this is absent here because of recursion. As you may know, you can often (or always?) replace iteration by recursion (which in general is not wise). Leen Ammeraal http://home.wxs.nl/~ammeraal/
This page took 0.01 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.