return null;
HashMap<Class<?>, SearchBotAction> actions = new HashMap<Class<?>, SearchBotAction>();
HashMap<Class<?>, Double> probs = new HashMap<Class<?>, Double>();
Class<?> cProb = null;
RaiseAction raiseAction = null;
BetAction betAction = null;
String errorStr = "";
InnerNode node = getNode(gameState);
if (node != null) {
errorStr = (">-----------------------------");
errorStr += ("\n" + getPlayerName(gameState) + " State " + gameState.getClass());
ImmutableList<INode> children = node.getChildren();
if (children != null) {
for (INode n : children) {
Class<?> c = n.getLastAction().getAction().getClass();
// Same actions are grouped to make one probability (bet/raise)
if (!probs.containsKey(c))
probs.put(c, n.getLastAction().getProbability());
else
probs.put(c, n.getLastAction().getProbability() + probs.get(c));
actions.put(c, n.getLastAction().getAction());
if (gameState.getClass().equals(
n.getLastAction().getAction()
.getUnwrappedStateAfterAction().getClass()) ||
// TODO: you shouldn't get BetAction in RaiseState (but it does happen somehow...)
(gameState.getClass().equals(RaiseState.class) &&
n.getLastAction().getAction().getClass().equals(BetAction.class))) {// ||
// // TODO: idem with Raise-/BetAction in AllinState (now this situation is ignored)
// (gameState.getClass().equals(AllInState.class) &&
// n.getLastAction().getAction().getClass().equals(BetAction.class))) {
if (cProb == null) {
errorStr += "\n Setting chosen node with action " + n.getLastAction().getAction();
parentOpponentModel.setChosenNode(n);
}
cProb = c;
if (raiseAction == null && c.equals(RaiseAction.class))
raiseAction = (RaiseAction) n.getLastAction().getAction();
else if (betAction == null && c.equals(BetAction.class))
betAction = (BetAction) n.getLastAction().getAction();
}
// Correct child node is chosen for bet/raise
if (cProb != null) {
if (raiseAction != null && c.equals(RaiseAction.class)) {
RaiseAction newRaiseAction = (RaiseAction) n.getLastAction().getAction();
if (Math.abs(newRaiseAction.amount - raiseAmount) <
Math.abs(raiseAction.amount - raiseAmount)) {
raiseAction = newRaiseAction;
errorStr += "\n Setting chosen node with action " + n.getLastAction().getAction();
parentOpponentModel.setChosenNode(n);