1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00

Simplify move_importance()

Drop a useless parameter. This works because ratio1 and ratio2
are ratios of linear combinations of thisMoveImportance and
otherMovesImportance and so the yscale cancels out.

Therefore the values of ratio1 and ratio2 are independent
of yscale and yscale can be retired.

The same applies to yshift, but here we want to ensure
move_importance() > 0, so directly hard-code this safety
guard in function definition.

Actually there are some small differences due to rounding errors
and usually are at most few millisecond, that's means below 1% of
returned time, apart from very short intervals in which a difference
of just 1 msec can raise to 2-3% of total available time.

No functional change.
This commit is contained in:
H. Felix Wittmann 2013-12-31 12:24:57 +01:00 committed by Marco Costalba
parent c5d478b923
commit 92faa74dfa

View file

@ -34,8 +34,6 @@ namespace {
const double xscale = 9.3;
const double xshift = 59.8;
const double yscale = 7780;
const double yshift = 1e-3; // Larger than 0. Ensures a non-zero importance
const double skewfactor = 0.172;
@ -46,7 +44,7 @@ namespace {
double move_importance(int ply) {
return yscale / pow((1 + exp((ply - xshift) / xscale)), skewfactor) + yshift;
return 1 / pow((1 + exp((ply - xshift) / xscale)), skewfactor) + 1e-3; // Ensure non-zero
}