diff --git a/chesspi/chesspi_ai.cpp b/chesspi/chesspi_ai.cpp index 80db663ead84330b2926b7ee0832b9d20cd6f8fb..7ba7cf1cbce971e2961b09d63cacb28e4275c47f 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);