Author: Dieter Buerssner
Date: 14:55:59 05/16/04
Go up one level in this thread
On May 16, 2004 at 17:27:10, Marc Bourzutschky wrote:
>On May 16, 2004 at 17:12:12, Dieter Buerssner wrote:
>
>>On May 16, 2004 at 14:28:48, Marc Bourzutschky wrote:
>>
>>>Max Euwe: 4,147,200
>>>Noam Elkies: 8,294,400
>>>Paul Epstein: 5,317,600
>>>Marc Bourzutschky: 5,149,368
>>
>>Dieter Bürßner: 4,665,582
>>
>>Idea: 2880 positions per side, of which 2694 have no castling possibilities.
>>
>>x = 2880^2-2694^2/2
>>
>>I fear, I thought too simple,
Indeed!
>If instead of 2694 in your formula you use 2508 you get the Bourzutschky result.
> The difference is that 2508 is the number of positions where neither the
>position itself, nor the mirrored position, has castling rights...
I agree with you. Thanks for pointing out my flaw.
Regards,
Dieter
PS. My simple C program (neither elegant nor efficient, but fast to write anyway
with some cut and paste) to come up with the numbers:
#include <stdio.h>
#include <stdlib.h>
enum {B /* black colored B, only */,N,R,Q,K,C /* white colored B */};
int main(void)
{
int sa, sb, sc, sd, se, sf, sg, sh, i, p[8], pm[8];
int n[C+1] = {1,2,2,1,1,1};
unsigned long count = 0, ccs=0, ccl=0, ccb=0, ccn=0, cfrc=0, ccnm=0;
size_t idx;
unsigned long t[C+1] = {0,1,2,3,4,0};
static unsigned char pos[5*5*5*5*5*5*5*5]; /* Will need 32 bit compiler. */
for (sa=B; sa<=K; sa++)
{
n[sa]--;
for (sb=N; sb<=C; sb++)
{
if (n[sb] == 0)
continue;
n[sb]--;
for (sc=B; sc<=K; sc++)
{
if (n[sc] == 0)
continue;
n[sc]--;
for (sd=N; sd<=C; sd++)
{
if (n[sd] == 0)
continue;
n[sd]--;
for (se=B; se<=K; se++)
{
if (n[se] == 0)
continue;
n[se]--;
for (sf=N; sf<=C; sf++)
{
if (n[sf] == 0)
continue;
n[sf]--;
for (sg=B; sg<=K; sg++)
{
if (n[sg] == 0)
continue;
n[sg]--;
for (sh=N; sh<=C; sh++)
{
if (n[sh] == 0)
continue;
idx = ((((((t[sa]*5 + t[sb])*5 + t[sc])*5 + t[sd])*5 +
t[se])*5
+ t[sf])*5 + t[sg])*5 + t[sh];
if (idx > sizeof pos)
{
/* Should never happen */
printf("idx=%lu\n", (unsigned long)idx);
return 1;
}
if (pos[idx] == 0) /* Should always be the case, sanity check
*/
{
count++;
pos[idx] = 1;
/* count FRC positions (just as a sanity check, should yield
960). */
p[0]=sa;
p[1]=sb;
p[2]=sc;
p[3]=sd;
p[4]=se;
p[5]=sf;
p[6]=sg;
p[7]=sh;
/* search first rook */
for (i=0; i<8; i++)
if (p[i] == R)
break;
/* search K after first R */
for (i++; i<8; i++)
if (p[i] == K)
break;
/* search R after K */
for (i++; i<8; i++)
if (p[i] == R)
cfrc++;
if (se==K && sa==R) /* Queen side castling */
ccl++;
if (se==K && sh==R) /* King side castling */
ccs++;
if (se==K && sh==R && sa==R) /* both sides */
ccb++;
if (se!=K || (sh != R && sa != R)) /* neither side */
{
ccn++;
/* mirror pos */
for (i=0; i<8; i++)
pm[i] = p[7-i];
if (pm[4]!=K || (pm[0] != R && pm[7] != R)) /* neither
side */
ccnm++;
}
}
}
n[sg]++;
}
n[sf]++;
}
n[se]++;
}
n[sd]++;
}
n[sc]++;
}
n[sb]++;
}
n[sa]++;
}
printf("c = %lu ccs %lu ccl %lu ccb %lu ccn %lu cfrc %lu ccnm %lu\n",
count, ccs, ccl, ccb, ccn, cfrc, ccnm);
/* Sanity check, should print original numbers */
for (sa=0; sa<=C; sa++)
printf("n[%d]=%d\n", sa, n[sa]);
return 0;
}
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.