From 72f7282ad4da0584c87163aed85bd5ff4d633cd3 Mon Sep 17 00:00:00 2001 From: Chris Caino Date: Tue, 22 Oct 2013 23:02:38 +0200 Subject: [PATCH] Simplify futility move count formula Simpler formula but introduces some slight changes if d >= 10 Original code grows like 0.225 * d^1.8 New code grows like 0.222 * d^1.8 Full list of values: d old new diff -------------- 0 2 2 0 1 2 2 0 2 3 3 0 3 4 4 0 4 5 5 0 5 6 6 0 6 7 7 0 7 9 9 0 8 11 11 0 9 13 13 0 10 15 16 1 11 18 19 1 12 21 21 0 13 24 24 0 14 27 28 1 15 31 31 0 16 35 35 0 17 39 38 -1 18 42 42 0 19 47 46 -1 20 51 51 0 21 55 55 0 22 60 60 0 23 65 65 0 24 70 70 0 25 75 75 0 26 81 80 -1 27 87 86 -1 28 92 91 -1 29 98 97 -1 30 104 103 -1 31 111 109 -2 Test code: int main() { for(int d=0; d<32; d++) { int a = int(3 + 0.3 * pow(double(d), 1.8)) * 3/4 + (2 < d && d < 5); int b = int(2.4 + 0.222 * pow(d + 0.0, 1.8)); std::cout << d << " " << a << " " << b << " " << b-a << std::endl; } return 0; } bench: 8350690 --- src/search.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 442f7f5d..7e9b8d77 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -155,8 +155,8 @@ void Search::init() { // Init futility move count array for (d = 0; d < 32; ++d) { - FutilityMoveCounts[0][d] = int(3 + 0.3 * pow(double(d ), 1.8)) * 3/4 + (2 < d && d < 5); - FutilityMoveCounts[1][d] = int(3 + 0.3 * pow(double(d + 0.98), 1.8)); + FutilityMoveCounts[0][d] = int(2.4 + 0.222 * pow(d + 0.0, 1.8)); + FutilityMoveCounts[1][d] = int(3.0 + 0.3 * pow(d + 0.98, 1.8)); } } -- 2.39.2