mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Ensure move_importance() is non-zero
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.
This commit is contained in:
parent
153309e287
commit
8454d871ec
1 changed files with 2 additions and 1 deletions
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
|
||||
#include "search.h"
|
||||
|
@ -44,7 +45,7 @@ namespace {
|
|||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue