Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Improving 6 men index scheme

Author: Eugene Nalimov

Date: 21:26:26 09/10/02

Go up one level in this thread


unsigned Enumerate2 (unsigned sq1, unsigned sq2)
{
    unsigned sqMin, sqMax;

    assert (sq1 != sq2 && sq1 < 64 && sq2 < 64);
    sqMin = (sq1 < sq2) ? sq1 : sq2;
    sqMax = (sq1 < sq2) ? sq2 : sq1;
    return sqMax*(sqMax-1)/2 + sqMin;
}

On September 10, 2002 at 17:24:50, Vincent Diepeveen wrote:

>On September 10, 2002 at 16:53:36, Heiner Marxen wrote:
>
>>On September 10, 2002 at 15:09:10, Vincent Diepeveen wrote:
>>
>>>On September 10, 2002 at 14:28:51, Guido wrote:
>>[snip]
>>>>It is not necessary to have a table for 1891 positions and one for 1128
>>>>position.
>>>>The 62*61/2 table can be used for all the case N*(N-1)/2 with N <= 62.
>>>>All these tables are contained inside the biggest. So 62*61/2 is the
>>>>biggest table because kings are already positioned.
>>>
>>>I do get the idea i could reuse it somehow but i don't understand it
>>>completely.
>>>
>>>suppose i have a chess board sized table [5][5]
>>>for a board of 5x5 to place 2
>>>pieces. lefttop = 0 of course. and entry 0 is illegal
>>>because 2 pieces cannot be on the same square and
>>>also second piece is at a higher square than the first:
>>>
>>
>>>Now suppose i use this table to index it for 2 similar pieces
>>>after 1 piece has been put already on the board.
>>>
>>>then i do not see how i index into this table
>>>anymore.
>>
>>Try this one (or a transposition of it):
>>table[5][5] = {
>>  {-1, 0, 1, 3, 6},
>>  {-1,-1, 2, 4, 7},
>>  {-1,-1,-1, 5, 8},
>>  {-1,-1,-1,-1, 9},
>>  {-1,-1,-1,-1,-1} }
>
>I see, that solves the problem completely indeed.
>
>>It also can be computed efficiently on-the-fly with a small table of
>>binomial coefficients.
>
>I am very interested in formula's doing that, because
>of 5 of the same men i won't put in a table.
>
>Already some mathematical stuff (with correction even!!) from Simon Finn
>gave me some great insights here that it should be possible.
>
>>Cheers,
>>Heiner



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.