Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Fast sort? - Bubble Sort!? (Question to Dr. Hyatt)

Author: Robert Hyatt

Date: 20:53:38 10/19/99

Go up one level in this thread


On October 19, 1999 at 22:25:50, Oliver Roese wrote:

>On October 18, 1999 at 19:49:30, Jeremiah Penery wrote:
>(...)
>
>>This is in even the new Crafty versions. :)  It says:
>>
>>/*
>> ----------------------------------------------------------
>>|                                                          |
>>|   don't disdain the lowly bubble sort here.  the list of |
>>|   captures is always short, and experiments with other   |
>>|   algorithms are always slightly slower.                 |
>>|                                                          |
>> ----------------------------------------------------------
>>*/
>
>Yes.
>It can be found three times.
>(quiesece.c, next.c, nexte.c)


One other point.  "insertion sort" won't work here.  Because I do the following:

1.  generate all the moves (they are placed in the moves[] array as they are
generated so that we end up with the moves already in the array before we start
the 'sort').

2.  compute the 'sort score'.  The moves are in the list, so a parallel array
is used to hold the scores.  These scores are produced move by move.

3.  sort both arrays at the same time so that the moves 'stick' with the scores.

It would be very hard to produce code that does the above, yet uses fewer
instructions (overall) than the simple bubble sort currently used.  If I
generated moves one at a time, perhaps 'insertion' would work.  But the code
to generate moves doesn't work like that (the overhead would be murder to
keep calling the generator to get the next move.)

Bob



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.