Author: Alvaro Jose Povoa Cardoso
Date: 02:23:28 04/28/02
Go up one level in this thread
Is the following modification to getdatabasesize() correct for computing the
maximum size of a database without bmrank and wmrank?
Another thing: using 28 instead of 27 and 32 instead of 31 gives a little
tolerance doesn't it? I mean: because of this there will be a few indices that
don't correspond to legal positions, right?
Thanks again,
Alvaro Cardoso
int64 getdatabasesize(int bm, int bk, int wm, int wk, int bmrank, int wmrank)
{
// returns the range of database indices for this database.
// needs binomial coefficients in the array bicoef[][] = choose from n, k
int64 dbsize = 1;
// number of bm configurations:
// there are bm black men subject to the constraint that one of them is on
// the rank bmrank
if(bm)
dbsize *= bicoef[28][bm];
if(wm)
dbsize *= bicoef[28][wm];
// number of bk configurations
if(bk)
dbsize *= bicoef[32-bm-wm][bk];
// number of wk configurations
if(wk)
dbsize *= bicoef[32-bm-wm-bk][wk];
return dbsize;
}
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.