Examples of GameState


Examples of org.cspoker.client.common.gamestate.GameState

    this.nodeVisitorFactories = nodeVisitorFactories;
  }

  @Override
  public void doNextAction() throws RemoteException, IllegalActionException {
    GameState gameState = tableContext.getGameState();
    NodeVisitor[] visitors = createVisitors(gameState);
    BotActionNode actionNode;
    // essential to do this with a clean game state from the
    // context, no wrappers
    config.getOpponentModel().assumePermanently(gameState);
    switch (gameState.getRound()) {
    case PREFLOP:
      logger.debug("Searching preflop round game tree:");
//      SearchConfiguration config2 = new SearchConfiguration(config.getOpponentModel(),
//          config.getShowdownNodeFactory(),
//          config.getBotNodeExpanderFactory(), 20000, 40000, 80000, 160000, 0.25, false, false);
View Full Code Here

Examples of org.cspoker.client.common.gamestate.GameState

  @Override
  public void doNextAction() throws RemoteException, IllegalActionException {
    startTime = System.currentTimeMillis();
    long endTime = System.currentTimeMillis()+decisionTime;
    GameState gameState = tableContext.getGameState()
    RootNode root = new RootNode(gameState,botId,config);
    logger.info("Starting MCTS iterations.");
    do{
      iterate(root);
      iterate(root);
View Full Code Here

Examples of org.cspoker.client.common.gamestate.GameState

  }

  @Override
  public void doNextAction() throws RemoteException, IllegalActionException {
//    long startTime = System.currentTimeMillis();
    GameState gameState = tableContext.getGameState()
    RootNode root = new RootNode(gameState,botId,config);
    switch (gameState.getRound()) {
    case PREFLOP: nbSamples = samplesPreFlop; break;
    case FLOP: nbSamples = samplesFlop; break;
    case TURN: nbSamples = samplesTurn; break;
    case FINAL: nbSamples = samplesRiver; break;
    default: throw new IllegalStateException(gameState.getRound().toString());
    }
    do{
      iterate(root);
      iterate(root);
      iterate(root);
View Full Code Here

Examples of org.cspoker.client.common.gamestate.GameState

    update();
  }
 
  private List<NavigableMap<Chip, Integer>> getBetPile(PlayerId player) {
    List<NavigableMap<Chip, Integer>> chipStacks = new ArrayList<NavigableMap<Chip, Integer>>();
    GameState gs = tableState.getGameState();
    if (gs == null) {
      logger.warn("GameState is null");
      return chipStacks;
    }
    PlayerState ps = gs.getPlayer(player);
    if (ps == null) {
      logger.warn("Player state for " + player + " is null");
      return chipStacks;
    }
    for (Integer i : ps.getBetProgression()) {
View Full Code Here

Examples of org.cspoker.client.common.gamestate.GameState

    if (action.endsInvolvementOf(bot)) {
      // bot folded
      return new ConstantLeafNode(this,probAction,gameState.getPlayer(bot).getStack());
    } else {
      try {
        GameState nextState = action.getStateAfterAction();
        // expand further
        if(nextState.getNextToAct().equals(bot)){
          return new DecisionNode(this, probAction, nextState, bot, config);
        }else{
          return new OpponentNode(this, probAction, nextState, bot, config);
        }
      } catch (GameEndedException e) {
View Full Code Here

Examples of org.cspoker.client.common.gamestate.GameState

    int oldBet = actorState.getBet();
    int largestBet = gameState.getLargestBet();
    int deficit = largestBet - oldBet;
    int movedAmount = deficit + amount;

    GameState raiseState;
    if (movedAmount >= stack) {
      raiseState = new AllInState(gameState, new AllInEvent(actor, movedAmount));
    } else {
      raiseState = new RaiseState(gameState, new RaiseEvent(actor, amount, movedAmount));
    }
View Full Code Here

Examples of org.cspoker.client.common.gamestate.GameState

    return raiseState;
  }

  @Override
  public GameState getStateAfterAction() {
    GameState raiseState = getUnwrappedStateAfterAction();
    return new NextPlayerState(raiseState, new NextPlayerEvent(raiseState
        .getNextActivePlayerAfter(actor).getPlayerId()));
  }
View Full Code Here

Examples of org.cspoker.client.common.gamestate.GameState

    PlayerState actorState = gameState.getPlayer(actor);
    int largestBet = gameState.getLargestBet();
    int stack = actorState.getStack();
    int bet = actorState.getBet();   

    GameState state;
    if (stack <= largestBet - bet) {
      state = new AllInState(gameState, new AllInEvent(actor, stack));
    } else {
      state = new CallState(gameState, new CallEvent(actor, largestBet - bet));
    }
View Full Code Here

Examples of org.cspoker.client.common.gamestate.GameState

        roundEnds = false;
        break forloop;
      }
    }
   
    GameState state = getUnwrappedStateAfterAction();
    int largestBet = gameState.getLargestBet();
   
    // what if small or big blind all-in?
    if (roundEnds
        && gameState.getRound().equals(Round.PREFLOP)
        && actor.equals(gameState.getSmallBlind())
        && largestBet <= gameState.getTableConfiguration()
            .getBigBlind()) {
      roundEnds = false;
    }
   
    if (roundEnds) {
      return getNewRoundState(state);
    } else {
      PlayerState nextActivePlayerAfter = state
          .getNextActivePlayerAfter(actor);
      if (nextActivePlayerAfter == null) {
        // BigBlind is all-in
        return getNewRoundState(state);
      }
View Full Code Here

Examples of org.cspoker.client.common.gamestate.GameState

      // bot folded
      return new ConstantLeafNode(gameState,gameState.getPlayer(botId)
          .getStack(),0, tokens);
    } else {
      try {
        GameState nextState = action.getAction().getStateAfterAction();
        // expand further
        PlayerId nextToAct = nextState.getNextToAct();
        if (nextToAct.equals(botId)) {
          // go to next player node
          return new BotActionNode(botId,
              nextState, config, config.getSampler(), tokens, searchId, visitors);
        } else {
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.