This commit is contained in:
narawat lamaiin
2024-05-11 16:47:57 +07:00
parent 724519f74b
commit 48deb7934e

View File

@@ -513,13 +513,17 @@ function runMCTS(
end
end
best_child_state = argmax([child.statevalue / child.visits for child in values(root.children)])
avgStateValue = 0
selectedChildKey = nothing
for (k, v) in root.children
k_avgStateValue = v.statevalue / v.visits
if k_avgStateValue > avgStateValue
avgStateValue = k_avgStateValue
selectedChildKey = k
end
end
return best_child_state
return root.children[selectedChildKey]
end