Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: What kind of sort to use?

Author: Pat King

Date: 05:21:13 08/02/00

Go up one level in this thread


On August 01, 2000 at 13:57:19, Tom Kerrigan wrote:

>On August 01, 2000 at 12:12:18, Pat King wrote:
>
>>On July 31, 2000 at 19:09:30, Tom Kerrigan wrote:
>>
>>>On July 31, 2000 at 18:11:37, William H Rogers wrote:
>>>
>>>>On July 31, 2000 at 13:17:20, Larry Griffiths wrote:
>>>>
>>>>>I am currently using a bubble sort to sort my captures list.
>>>>>
>>>>>I plan to change it to a selection sort.
>>>>>
>>>>>Do any of you use another type of sort like quicksort to sort your lists or do
>>>>>you have any preferences?
>>>>>
>>>>>Larry :)
>>>>
>>>>When I was in college, they told us that with short lists, the old bubble sort
>>>>was faster than all of the newer sorts that were in vogue. I tried it out using
>>>>the old GWBasic and the bubble won with 50 or fewer items, so I would keep the
>>>>one that you are using. If it works, don't fix it.
>>>>Bill
>>>
>>>Remember, this is for the case when all items of a list must be sorted. Not so
>>>in chess (due to alpha-beta cutoffs).
>>>-Tom
>>
>>Couldn't you do the sort incrementally, too, the inner loop of bubble sort
>>in the search loop?
>>ie:
>>Search(int F,int D, int A, int B){
>>//yada yada yada
>>L = GenMoveList(F); // moves stored in global ML[F..L]
>>for (int i = F; i<=L; i++) {
>>  PutBestMoveOnTop(i,L);// inner loop of bubble sort
>>  MakeMove(ML[i]);
>>  A = MAX(A,-Search(L+1,D-1,-B,-A));
>>  Unmove();
>>  if (A >= B) break;
>>};
>>// more yada yada yada
>>return A;
>>};
>>
>>Thus the sort stops as soon as a cutoff is found, often with only one
>>scan of ML[F..L]. Good thread, this just occurred to me. Now that I've
>>said it, I have to go try it ;)
>>
>>Pat
>
>Yes, this is done in most programs, I think. It's a good idea. :)
None of my best ideas are original ones ;)

Pat
>
>-Tom



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.