Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Programing: List of Pieces

Author: Russell Reagan

Date: 12:35:59 07/09/02

Go up one level in this thread


On July 09, 2002 at 15:22:45, Andreas Guettinger wrote:

>I once tried to update the size of the pieces list dynamically, so that it
>shortens after a capture in the search. I had the idea to change the current
>list position of the deleted figure with the last one and zero it. undoMove()
>should then ad the figure back at the end of the list and change it back with
>the original place. But somehow I never got it to work, and it was not worth
>becuse the additional code would slow down doMove() and undoMove(). So zeroing
>is ok, I think.

If you wanted to accomplish this, it's not very hard. Let's say that you have a
piece in index 4 of your piece list, and that there are pieces in all indexes up
to index 10. You just swap what's in index with 4 index 10, and then decrement
the size of your piece list for that side. Then in your unmake function, you can
just increment the size of your piece list, and now you have all of your pieces
back. If keeping the pieces in some kind of order is important to your program,
then this won't work, but I don't think it will matter if you have good move
ordering techniques.

Russell



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.