From dafbc87a818fce580145370833f74df4ff1d9a85 Mon Sep 17 00:00:00 2001 From: "dev@dev.com" Date: Wed, 9 Jun 2021 16:55:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83=E7=AE=97=E6=B3=95?= 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 80db663..7ba7cf1 100644 --- a/chesspi/chesspi_ai.cpp +++ b/chesspi/chesspi_ai.cpp @@ -185,17 +185,17 @@ size_t judge_tree(std::vector & tree) { if (tree[i].side==0) { - float ratio = sqrt((tree[i].jump_cost[1]+1) / (tree[i].jump_cost[0]+1)/ (tree[i].jump_cost[0]+1)); + float ratio = (tree[i].jump_cost[1]+1) / (tree[i].jump_cost[0]+1)/sqrt(tree[i].jump_cost[0]+1); tree[i].weight = ratio; } else { - float ratio = sqrt((tree[i].jump_cost[0]+1) / (tree[i].jump_cost[1]+1)/ (tree[i].jump_cost[1]+1)); + float ratio = (tree[i].jump_cost[0]+1) / (tree[i].jump_cost[1]+1)/sqrt(tree[i].jump_cost[0]+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[i].depth; - tree[parent].jump_cost[1] += tree[i].jump_cost[1] * tree[i].weight/tree[i].depth/tree[i].depth; + 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; --i; if (i%1000==0) printf ("Sorting.%d... \r",total_nodes - i); -- GitLab