In case ply is very high, function will round
to zero (although mathematically it is always
bigger than zero). On my system this happens at
movenumber 6661.
Although 6661 moves in a game is, of course,
probably impossible, for safety and to be locally
consistent makes sense to ensure returned value
is positive.
Non functional change.
*/
#include <algorithm>
+#include <cfloat>
#include <cmath>
#include "search.h"
double move_importance(int ply) {
- return pow((1 + exp((ply - xshift) / xscale)), -skewfactor);
+ return pow((1 + exp((ply - xshift) / xscale)), -skewfactor) + DBL_MIN; // Ensure non-zero
}