Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: About getdatabasesize()

Author: martin fierz

Date: 11:21:58 04/28/02

Go up one level in this thread


On April 28, 2002 at 05:23:28, Alvaro Jose Povoa Cardoso wrote:

>Is the following modification to getdatabasesize() correct for computing the
>maximum size of a database without bmrank and wmrank?

yes, it looks correct.

>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?

no - there are 28 squares where men can be, and 32 where kings can be, not 27
and 31...

aloha
  martin


>
>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.