1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Codestyle massage Search::init()

* remove some erroneous comments, that were based on the ONE_PLY == 2.
* rename hd to d, because there's no more half-depth in SF.
* rescope variables into the for loops.
* reindent the for loops correctly.
* add a comment to explain the eval improving part (not so obvious to read
this code as array has 4 dimensions).

No functional change.
This commit is contained in:
lucasart 2014-11-08 10:56:51 -05:00 committed by Gary Linscott
parent 3d2aab11d8
commit 8631b08d97

View file

@ -116,28 +116,26 @@ namespace {
void Search::init() {
int d; // depth (ONE_PLY == 2)
int hd; // half depth (ONE_PLY == 1)
int mc; // moveCount
// Init reductions array
for (hd = 1; hd < 64; ++hd) for (mc = 1; mc < 64; ++mc)
{
double pvRed = 0.00 + log(double(hd)) * log(double(mc)) / 3.00;
double nonPVRed = 0.33 + log(double(hd)) * log(double(mc)) / 2.25;
for (int d = 1; d < 64; ++d)
for (int mc = 1; mc < 64; ++mc)
{
double pvRed = 0.00 + log(double(d)) * log(double(mc)) / 3.00;
double nonPVRed = 0.33 + log(double(d)) * log(double(mc)) / 2.25;
Reductions[1][1][hd][mc] = int8_t( pvRed >= 1.0 ? pvRed + 0.5: 0);
Reductions[0][1][hd][mc] = int8_t(nonPVRed >= 1.0 ? nonPVRed + 0.5: 0);
Reductions[1][1][d][mc] = int8_t( pvRed >= 1.0 ? pvRed + 0.5: 0);
Reductions[0][1][d][mc] = int8_t(nonPVRed >= 1.0 ? nonPVRed + 0.5: 0);
Reductions[1][0][hd][mc] = Reductions[1][1][hd][mc];
Reductions[0][0][hd][mc] = Reductions[0][1][hd][mc];
Reductions[1][0][d][mc] = Reductions[1][1][d][mc];
Reductions[0][0][d][mc] = Reductions[0][1][d][mc];
if (Reductions[0][0][hd][mc] >= 2)
Reductions[0][0][hd][mc] += 1;
}
// Increase reduction when eval is not improving
if (Reductions[0][0][d][mc] >= 2)
Reductions[0][0][d][mc] += 1;
}
// Init futility move count array
for (d = 0; d < 32; ++d)
for (int d = 0; d < 32; ++d)
{
FutilityMoveCounts[0][d] = int(2.4 + 0.773 * pow(d + 0.00, 1.8));
FutilityMoveCounts[1][d] = int(2.9 + 1.045 * pow(d + 0.49, 1.8));