Examples of BetAction


Examples of org.cspoker.ai.bots.bot.gametree.action.BetAction

   
    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);
              }
            }
            else if (betAction != null && c.equals(BetAction.class)) {
              BetAction newBetAction = (BetAction) n.getLastAction().getAction();
              if (Math.abs(newBetAction.amount - raiseAmount) <
                  Math.abs(betAction.amount - raiseAmount)) {
                betAction = newBetAction;
                errorStr += "\n Setting chosen node with action " + n.getLastAction().getAction();
                parentOpponentModel.setChosenNode(n);
View Full Code Here

Examples of org.cspoker.ai.bots.bot.gametree.action.BetAction

            amountInt = upperRaiseBound;
          if (raise){
            actions.add(new ProbabilityAction(new RaiseAction(gameState,
                actor, amountInt), tmpProbability));
          } else
            actions.add(new ProbabilityAction(new BetAction(gameState,
                actor, amountInt), tmpProbability));
          tmpProbability = 0.0;
        }
       
      }
    } else {
      if (raise)
        actions.add(new ProbabilityAction(new RaiseAction(gameState,
            actor, lowerRaiseBound), raiseProbability));
      else
        actions.add(new ProbabilityAction(new BetAction(gameState,
            actor, lowerRaiseBound), raiseProbability));
    }
  }
View Full Code Here

Examples of org.ozsoft.texasholdem.actions.BetAction

                    } else if (aggression == 100) {
                        // Always go all-in!
                        //FIXME: Check and bet/raise player's remaining cash.
                        int amount = (tableType == TableType.FIXED_LIMIT) ? minBet : 100 * minBet;
                        if (allowedActions.contains(Action.BET)) {
                            action = new BetAction(amount);
                        } else if (allowedActions.contains(Action.RAISE)) {
                            action = new RaiseAction(amount);
                        } else if (allowedActions.contains(Action.CALL)) {
                            action = Action.CALL;
                        } else {
                            action = Action.CHECK;
                        }
                    } else {
                        int amount = minBet;
                        if (tableType == TableType.NO_LIMIT) {
                            int betLevel = aggression / 20;
                            for (int i = 0; i < betLevel; i++) {
                                amount *= 2;
                            }
                        }
                        if (currentBet < amount) {
                            if (allowedActions.contains(Action.BET)) {
                                action = new BetAction(amount);
                            } else if (allowedActions.contains(Action.RAISE)) {
                                action = new RaiseAction(amount);
                            } else if (allowedActions.contains(Action.CALL)) {
                                action = Action.CALL;
                            } else {
View Full Code Here

Examples of org.ozsoft.texasholdem.actions.BetAction

                        repaint();
                    }
                });
                selectedAction = amountPanel.show(selectedAction, minBet, cash);
                if (selectedAction == Action.BET) {
                    selectedAction = new BetAction(amountPanel.getAmount());
                } else if (selectedAction == Action.RAISE) {
                    selectedAction = new RaiseAction(amountPanel.getAmount());
                } else {
                    // User cancelled.
                    selectedAction = null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.