implement solved

This commit is contained in:
ramollia
2026-01-20 13:15:48 +01:00
parent e5ea838430
commit f7b24edf1e
10 changed files with 27 additions and 16 deletions

View File

@@ -107,8 +107,7 @@ public abstract class MCTSAI extends AbstractAI {
}
protected Node selection(Node root) {
// while (Float.isNaN(root.solved) && root.isFullyExpanded() && !root.state.isTerminal()) {
while (root.isFullyExpanded() && !root.state.isTerminal()) {
while (Float.isNaN(root.solved) && root.isFullyExpanded() && !root.state.isTerminal()) {
root = root.bestUCTChild();
}

View File

@@ -23,8 +23,7 @@ public class MCTSAI1 extends MCTSAI {
final long endTime = System.nanoTime() + milliseconds * 1_000_000L;
// while (Float.isNaN(root.solved) && System.nanoTime() < endTime) {
while (System.nanoTime() < endTime) {
while (Float.isNaN(root.solved) && System.nanoTime() < endTime) {
Node leaf = selection(root);
leaf = expansion(leaf);
final float value = simulation(leaf);

View File

@@ -29,8 +29,7 @@ public class MCTSAI2 extends MCTSAI {
final long endTime = System.nanoTime() + milliseconds * 1_000_000L;
// while (Float.isNaN(root.solved) && System.nanoTime() < endTime) {
while (System.nanoTime() < endTime) {
while (Float.isNaN(root.solved) && System.nanoTime() < endTime) {
Node leaf = selection(root);
leaf = expansion(leaf);
final float value = simulation(leaf);

View File

@@ -41,8 +41,7 @@ public class MCTSAI3 extends MCTSAI {
tasks.add(() -> {
final Node localRoot = new Node(game.deepCopy());
// while (Float.isNaN(localRoot.solved) && System.nanoTime() < endTime) {
while (System.nanoTime() < endTime) {
while (Float.isNaN(localRoot.solved) && System.nanoTime() < endTime) {
Node leaf = selection(localRoot);
leaf = expansion(leaf);
final float value = simulation(leaf);

View File

@@ -50,8 +50,7 @@ public class MCTSAI4 extends MCTSAI {
tasks.add(() -> {
final Node localRoot = threadRoots[threadIndex];
// while (Float.isNaN(localRoot.solved) && System.nanoTime() < endTime) {
while (System.nanoTime() < endTime) {
while (Float.isNaN(localRoot.solved) && System.nanoTime() < endTime) {
Node leaf = selection(localRoot);
leaf = expansion(leaf);
final float value = simulation(leaf);