Modified:
/trunk/ai/opponentmodels/weka/src/main/java/org/cspoker/ai/opponentmodels/weka/ActionTrackingVisitor.java
=======================================
---
/trunk/ai/opponentmodels/weka/src/main/java/org/cspoker/ai/opponentmodels/weka/ActionTrackingVisitor.java
Sun Aug 8 07:25:37 2010
+++
/trunk/ai/opponentmodels/weka/src/main/java/org/cspoker/ai/opponentmodels/weka/ActionTrackingVisitor.java
Sun Aug 8 07:42:29 2010
@@ -51,11 +51,7 @@
return (ARFFPropositionalizer) this.propz;
}
- private InnerNode getNode(GameState state) {
- // This method is only called after MCTSBot has acted
- if (parentOpponentModel.getChosenNode() == null)
- throw new IllegalStateException("MCTSBot hasn't acted yet!");
-
+ private InnerNode getNode(GameState state) {
try {
return (InnerNode) parentOpponentModel.getChosenNode();
} catch (ClassCastException e) {
@@ -99,6 +95,10 @@
*/
private String str = "";
private Prediction getProbability(GameState gameState, double
raiseAmount) {
+ // This method should only be called after MCTSBot has acted
+ if (parentOpponentModel.getChosenNode() == null)
+ return new Prediction(null, 1, 0);
+
HashMap<Class<?>, Double> probs = new HashMap<Class<?>, Double>();
Class<?> cProb = null;
RaiseAction raiseAction = null;
@@ -172,7 +172,7 @@
// chosen node of opponentmodel should have changed
if (parentOpponentModel.getChosenNode() == node) {
System.err.println(str);
- throw new IllegalStateException("You should always chose a child
node!");
+ throw new IllegalStateException("You should always choose a child
node!");
}
return new
Prediction(parentOpponentModel.getChosenNode().getLastAction().getAction(),