Added:
/trunk/ai/bots/src/main/java/org/cspoker/ai/bots/bot/gametree/tls/SimulatedGame.java
Modified:
/trunk/ai/bots/src/main/java/org/cspoker/ai/bots/bot/gametree/tls/nodes/AbstractTLSNode.java
/trunk/ai/bots/src/main/java/org/cspoker/ai/bots/bot/gametree/tls/nodes/InnerNode.java
/trunk/ai/bots/src/main/java/org/cspoker/ai/bots/bot/gametree/tls/tests/Test.java
=======================================
--- /dev/null
+++
/trunk/ai/bots/src/main/java/org/cspoker/ai/bots/bot/gametree/tls/SimulatedGame.java
Thu Mar 24 02:21:26 2011
@@ -0,0 +1,21 @@
+package org.cspoker.ai.bots.bot.gametree.tls;
+
+import java.util.Stack;
+
+import org.cspoker.ai.bots.bot.gametree.action.SearchBotAction;
+/**
+ *
+ * @author thijs
+ *
+ * Class to keep track of the actions taken during selection and
simulation. This information is important to update tests during
backpropagation.
+ *
+ */
+public class SimulatedGame extends Stack<SearchBotAction>{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -628544300776476142L;
+
+
+}
=======================================
---
/trunk/ai/bots/src/main/java/org/cspoker/ai/bots/bot/gametree/tls/nodes/AbstractTLSNode.java
Wed Mar 23 16:30:44 2011
+++
/trunk/ai/bots/src/main/java/org/cspoker/ai/bots/bot/gametree/tls/nodes/AbstractTLSNode.java
Thu Mar 24 02:21:26 2011
@@ -1,10 +1,19 @@
package org.cspoker.ai.bots.bot.gametree.tls.nodes;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.cspoker.ai.bots.bot.gametree.action.SearchBotAction;
+import org.cspoker.ai.bots.bot.gametree.tls.SimulatedGame;
+import org.cspoker.ai.bots.bot.gametree.tls.tests.Test;
+
public abstract class AbstractTLSNode {
protected AbstractTLSNode leftChild;
protected AbstractTLSNode rightChild;
+ private List<Test> possibleTests = new ArrayList<Test>();
+
public AbstractTLSNode(AbstractTLSNode parent){
this.parent = parent;
}
@@ -24,6 +33,23 @@
public AbstractTLSNode getParent() {
return parent;
}
-
+
+ public void backPropagate(double value, SimulatedGame game){
+ SearchBotAction action = game.pop();
+ if(!isSplit()){
+ for (Test test : possibleTests) {
+ test.updateStats(action, value);
+ }
+ }
+ }
+
+ protected boolean isSplit(){
+ return rightChild != null;
+ }
+
+ public void split(){
+ leftChild = new LeafNode(getParent());
+ rightChild = new LeafNode(getParent());
+ }
}
=======================================
---
/trunk/ai/bots/src/main/java/org/cspoker/ai/bots/bot/gametree/tls/nodes/InnerNode.java
Wed Mar 23 16:30:44 2011
+++
/trunk/ai/bots/src/main/java/org/cspoker/ai/bots/bot/gametree/tls/nodes/InnerNode.java
Thu Mar 24 02:21:26 2011
@@ -11,10 +11,5 @@
// TODO Auto-generated method stub
return null;
}
-
- public void split(){
- getParent().leftChild = new LeafNode(getParent());
- getParent().rightChild = new LeafNode(getParent());
- }
}
=======================================
---
/trunk/ai/bots/src/main/java/org/cspoker/ai/bots/bot/gametree/tls/tests/Test.java
Thu Mar 24 01:12:20 2011
+++
/trunk/ai/bots/src/main/java/org/cspoker/ai/bots/bot/gametree/tls/tests/Test.java
Thu Mar 24 02:21:26 2011
@@ -1,5 +1,12 @@
package org.cspoker.ai.bots.bot.gametree.tls.tests;
+import org.cspoker.ai.bots.bot.gametree.action.SearchBotAction;
+
public class Test {
-}
+ public void updateStats(SearchBotAction action, double value) {
+ // TODO Auto-generated method stub
+
+ }
+
+}