diff --git a/bugreports/bugreport09012012.png b/bugreports/bugreport09012012.png new file mode 100644 index 0000000..675cbff Binary files /dev/null and b/bugreports/bugreport09012012.png differ diff --git a/src/net/woodyfolsom/msproj/GoGame.java b/src/net/woodyfolsom/msproj/GoGame.java index 30aa282..19e5d35 100644 --- a/src/net/woodyfolsom/msproj/GoGame.java +++ b/src/net/woodyfolsom/msproj/GoGame.java @@ -47,7 +47,7 @@ public class GoGame { } else if ("alphabeta".equals(policyName)) { return new AlphaBeta(); } else if ("montecarlo".equals(policyName)) { - return new MonteCarloUCT(new RandomMovePolicy(), 2000L); + return new MonteCarloUCT(new RandomMovePolicy(), 10000L); } else { LOGGER.info("Unable to create Policy for unsupported name: " + policyName); System.exit(INVALID_MOVE_GENERATOR); diff --git a/src/net/woodyfolsom/msproj/policy/MonteCarlo.java b/src/net/woodyfolsom/msproj/policy/MonteCarlo.java index fe0c18e..5ca0d97 100644 --- a/src/net/woodyfolsom/msproj/policy/MonteCarlo.java +++ b/src/net/woodyfolsom/msproj/policy/MonteCarlo.java @@ -13,7 +13,7 @@ import net.woodyfolsom.msproj.tree.GameTreeNode; import net.woodyfolsom.msproj.tree.MonteCarloProperties; public abstract class MonteCarlo implements Policy { - protected static final int ROLLOUT_DEPTH_LIMIT = 20; + protected static final int ROLLOUT_DEPTH_LIMIT = 100; protected int numStateEvaluations = 0; protected Policy movePolicy; diff --git a/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java b/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java index 6c095d3..e4dce05 100644 --- a/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java +++ b/src/net/woodyfolsom/msproj/policy/MonteCarloUCT.java @@ -82,7 +82,11 @@ public class MonteCarloUCT extends MonteCarlo { } nextGameState.playStone(player, action); List> newChildren = new ArrayList>(); - newChildren.add(new GameTreeNode(nextGameState,new MonteCarloProperties())); + GameTreeNode newChild = new GameTreeNode(nextGameState,new MonteCarloProperties()); + + newChildren.add(newChild); + node.addChild(action, newChild); + return newChildren; } @@ -108,6 +112,8 @@ public class MonteCarloUCT extends MonteCarlo { } } while (action != Action.NONE && rolloutDepth < ROLLOUT_DEPTH_LIMIT); + numStateEvaluations++; + if (stateEvaluator.scoreGame(finalGameState).isWinner(player)) { return 1; } else { diff --git a/test/net/woodyfolsom/msproj/policy/MonteCarloUCTTest.java b/test/net/woodyfolsom/msproj/policy/MonteCarloUCTTest.java index 4ead0ac..e840193 100644 --- a/test/net/woodyfolsom/msproj/policy/MonteCarloUCTTest.java +++ b/test/net/woodyfolsom/msproj/policy/MonteCarloUCTTest.java @@ -13,7 +13,7 @@ import org.junit.Test; public class MonteCarloUCTTest { @Test public void testGenmoveAsW() { - Policy treeSearch = new MonteCarloUCT(new RandomMovePolicy(),2000L); + Policy treeSearch = new MonteCarloUCT(new RandomMovePolicy(),10000L); GameState gameState = new GameState(6); gameState.playStone(Player.WHITE, Action.getInstance("A2")); gameState.playStone(Player.WHITE, Action.getInstance("B1")); @@ -35,7 +35,7 @@ public class MonteCarloUCTTest { @Test public void testGenmoveAsB() { - Policy treeSearch = new MonteCarloUCT(new RandomMovePolicy(),2000L); + Policy treeSearch = new MonteCarloUCT(new RandomMovePolicy(),10000L); GameState gameState = new GameState(6); gameState.playStone(Player.BLACK, Action.getInstance("A2")); gameState.playStone(Player.BLACK, Action.getInstance("B1"));