From f67b97180e6dd864f72a5c3839d759fd2843a1b4 Mon Sep 17 00:00:00 2001 From: manjaro Date: Sat, 12 Jun 2021 23:35:40 +0100 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E6=9D=83=E8=B0=83=E6=95=B4=E6=9C=89?= =?UTF-8?q?=E5=89=AF=E4=BD=9C=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chesspi/chesspi_ai.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chesspi/chesspi_ai.cpp b/chesspi/chesspi_ai.cpp index 2a67da0..3ed630a 100644 --- a/chesspi/chesspi_ai.cpp +++ b/chesspi/chesspi_ai.cpp @@ -173,17 +173,17 @@ size_t judge_tree(std::vector & tree) { if (tree[i].side==0) { - float ratio = (tree[i].jump_cost[1]+1) / (tree[i].jump_cost[0]+1)/sqrt(tree[i].jump_cost[0]+1); + float ratio = sqrt((tree[i].jump_cost[1]+1) / (tree[i].jump_cost[0]+1)/ (tree[i].jump_cost[0]+1)); tree[i].weight = ratio; } else { - float ratio = (tree[i].jump_cost[0]+1) / (tree[i].jump_cost[1]+1)/sqrt(tree[i].jump_cost[0]+1); + float ratio = sqrt((tree[i].jump_cost[0]+1) / (tree[i].jump_cost[1]+1)/ (tree[i].jump_cost[1]+1)); tree[i].weight = ratio; } size_t parent = tree[i].parent; - tree[parent].jump_cost[0] += tree[i].jump_cost[0] * tree[i].weight/tree[i].depth; - tree[parent].jump_cost[1] += tree[i].jump_cost[1] * tree[i].weight/tree[i].depth; + tree[parent].jump_cost[0] += tree[i].jump_cost[0] * tree[i].weight/tree[i].depth/tree[i].depth; + tree[parent].jump_cost[1] += tree[i].jump_cost[1] * tree[i].weight/tree[i].depth/tree[i].depth; --i; if (i%1000==0) printf ("Sorting.%d... \r",total_nodes - i); -- GitLab