bug-gnubg
[Top][All Lists]

## [Bug-gnubg] Live cube take points: error in gnubg doc + remark

 From: Massimiliano Maini Subject: [Bug-gnubg] Live cube take points: error in gnubg doc + remark Date: Wed, 1 Jul 2009 13:54:28 +0200

Hi all,

I was digging into cubeful stuff and I took a look at GetPoints (in matchequity.c)
and at the gnubg documentation (gnubg.pdf/.html).

In gnubg.pdf, paragraph 11.5.5.2 "Live cube equities", there's the following:

For match play there is no simple formula, since redoubles can only occur a
limited number of times. The live cube take point is generally calculated as

TP(live, n Cube)=TP(dead, n cube) * (1 - TP(live, 2n cube)

There's a missing bracket at the end and, most important, the term:

should be replaced with the term:

TP(effective, n cube)

I have triple checked this comparing what's stated in Janowski's paper on the
subject (which has been used as basis for gnubg live cube code) and with what's
actually in the code.

I am fairly sure of the above: Janowski uses the effective TP and in gnubg code
you have this in GetPoints (matchequity.c lines 586- ...) :

/* Doubled cube is alive */

/* redouble, pass */

rRDP =

aarMETResults[k][DTL];

/* double, pass */

rDP =
aarMETResults[k][DP];

/* double, take win */

rDTW =
( 1.0f - arG[ k ] - arBG[ k ] ) *
aarMETResults[k][DTW]

+ arG[ k ] * aarMETResults[k][DTWG]

+ arBG[ k ] * aarMETResults[k][DTWB];

arCPLive[ k ][ n ] =
1.0f - arCPLive[ ! k ][ n + 1] * ( rDP - rDTW ) / ( rRDP - rDTW );

The last line constaind the formula (where TPs have been replaced by CPs): its
last term (the ratio) is not the dead TP, it's the effective TP. I do think the doc
is wrong.

As a remark, dead cube CPs are computed in lines 561-577: they are only used for
the last term of the recursive formula (line 583), as expected. However, they are
computed at each iteration (recursion), which is not really necessary.

I think that lines 561-577 should go into the if on line 581: don't know if it's such a
big deal, but GetPoints is supposed to be a "critical" function (called a lot), right ?

Notice also that in that case, there would be no need for arCPDead to be declared,
except for debug purposes (at the end of GetPoints there's some debug code
commented out).

I compared the debug output (and Hint output) before and after the change on a
single position, no difference except computation of dead CP at cube values where
it is anyway unused.

MaX.