Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: "Piece List" - Administration?

Author: Dann Corbit

Date: 11:11:20 03/03/03

Go up one level in this thread


On March 03, 2003 at 14:01:58, Andreas Guettinger wrote:

>On March 03, 2003 at 13:27:24, Dann Corbit wrote:
>
>>On March 03, 2003 at 13:18:41, Andreas Guettinger wrote:
>>
>>>On March 03, 2003 at 11:44:29, Albert Bertilsson wrote:
>>>
>>>>Here is how I do it:
>>>>
>>>>Have a piece list per side, one counter for each side telling the number of
>>>>pieces.
>>>>
>>>>If you make a capture, swap the piece last in the array with the captured piece
>>>>and decrease the counter for that list.
>>>>
>>>>For the captured piece in the list you need to store is original list position.
>>>>
>>>>In undo move you can just increase the counter and swap the piece back.
>>>>
>>>>/Regards Albert
>>>
>>>I have a similar piece list. Because I want it sorted from the highest to the
>>>lowest valued piece (for SEE/MVA), some small sorting is needed during
>>>promotion. Recently I thought if it would not be faster to just copy the whole
>>>picelist before domove() and restore it after undomove(). Any ideas?
>>
>>Have a separate piece list for every piece type.  Then it is always sorted
>>without any work.
>
>
>But then, when I have to scan to the piecelist, I have to scan through 12 lists.
>I don't like that.

12 checks for a count of zero, compared to sorting.  Which do you like better?

Another plus for separate piece lists:

while (knights--) do_knight_moves();
verses:
switch (piece_type)
{
case knight:
do_knight_moves();
break;
...
}



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.