diff --git a/chesspi/chesspi_ai.cpp b/chesspi/chesspi_ai.cpp index 2a67da046b819360ad57b739aed168d313a6aaa1..3ed630a46475aa545671095fd94247e292fc4ffa 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);