[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnubg] rollout settings
From: |
Nis Jorgensen |
Subject: |
Re: [Bug-gnubg] rollout settings |
Date: |
Tue, 29 Oct 2002 21:06:42 +0100 |
On 29 Oct 2002 at 14:35, Jim Segrave wrote:
> On Tue 29 Oct 2002 (11:20 -0000), Ian Shaw wrote:
>
> > Thanks for the clarifications, everyone. The rotation behaviour is
> > as logical as once could expect, at least until the randomisation of
> > the sequence is implemented. I always roll out in multiples of 36
> > anyway, but I'll now be reassured when looking at others results.
>
> If there are no major problems with the rollout patches I just
> submitted, I think I'll look at adding randomisation of the order of
> the rolls within a rotation so stopping a 1296 trial rollout is less
> likely to be way
Here is my suggestion for how to do it. I am afraid it includes a
dynamically sized array (to hold the rolls used for move number n).
This means that I cannot really do the programming - but here it is
in something that might look like C, but isn't. Note that the
randomization algorithm is missing ... this should be done based on
the rng, and I have no idea how. If anyone has ideas for how to
extend the "exaxt" rotation of rolls beyond 2 turns, I am very
interested. I think I will try asking in a math newsgroup one of
these days.
Explanations of algorithm will follow - I need people to tell me what
is not understandable.
static int QuasiRandomDice( int iTurn, int iGame, int cGames,
int fInitial,
int anDice[ 2 ],
const rng rngx,
const int fRotate ) {
int aRolls[*][36][2] //Dynamic array holding rolls for all moves
if (iGame == 0 || iTurn > aRolls->size ) then
/*We need to initialize the rolls */
{
aRolls->size++
for (i==0;i<6;i++)
{
for (j==0;j<6;j++)
{
aRolls[iTurn][i*6+j][0] = i+1
aRolls[iTurn][i*6+j][1] = j+1
}
}
Randomize (aRolls[iTurn]);
} else if (iGame % 36 == 0 && iTurn > 1)
/* We need to randomize the rolls */
{
Randomize (aRolls[iTurn]);
}
if (iTurn == 0)
{
anDice[ 0 ] = aRolls[iTurn][iGame %36][0]
anDice[ 1 ] = aRolls[iTurn][iGame %36][1]
} else if (iTurn == 1)
{
anDice[ 0 ] = aRolls[iTurn][iGame % 36 + iGame / 36][0]
anDice[ 1 ] = aRolls[iTurn][iGame %36 + iGame / 36][1]
} else
{
anDice[ 0 ] = aRolls[iTurn][iGame % 36][0]
anDice[ 1 ] = aRolls[iTurn][iGame %36][1]
}
}
--
Nis Jorgensen
Van Bossestraat 29 1, 1051 JS Amsterdam
Home Mobile: +31 (6) 1496 3629
Work: +31 (20) 52 36 202