Package org.cspoker.client.common.gamestate

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


        && gameState.getLargestBet() <= gameState
            .getTableConfiguration().getBigBlind()) {
      roundEnds = false;
    }

    GameState foldState = getUnwrappedStateAfterAction();

    if (!roundEnds) {
      return new NextPlayerState(foldState, new NextPlayerEvent(foldState
          .getNextActivePlayerAfter(actor).getPlayerId()));
    }
    return getNewRoundState(foldState);
  }
View Full Code Here


    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

  @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

  }

  @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

    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

    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

    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

    return raiseState;
  }

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

    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

        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

TOP

Related Classes of org.cspoker.client.common.gamestate.GameState

Copyright © 2018 www.massapicom. 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.