Package org.cspoker.client.common.gamestate

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


        || gameState.getRound().equals(Round.PREFLOP)
        && actor.equals(gameState.getBigBlind())
        && gameState.getLargestBet() <= gameState
            .getTableConfiguration().getBigBlind();

    GameState checkState = getUnwrappedStateAfterAction();
    if (!newRound) {
      return new NextPlayerState(checkState, new NextPlayerEvent(
          nextToAct.getPlayerId()));
    }
    return getNewRoundState(checkState);
View Full Code Here

    context.betOrRaise(amount);
  }

  @Override
  public GameState getUnwrappedStateAfterAction() {
    GameState betState;
    int stack = gameState.getPlayer(actor).getStack();
    if (stack == amount) {
      betState = new AllInState(gameState, new AllInEvent(actor, amount));
    } else if (stack > amount) {
      betState = new BetState(gameState, new BetEvent(actor, amount));
View Full Code Here

    return betState;
  }

  @Override
  public GameState getStateAfterAction() {
    GameState betState = getUnwrappedStateAfterAction();
    PlayerState nextToAct = betState.getNextActivePlayerAfter(actor);
    if (nextToAct != null) {
      return new NextPlayerState(betState, new NextPlayerEvent(nextToAct
          .getPlayerId()));
    }
    throw new IllegalStateException("Round can't be over after a bet.");
View Full Code Here

    super(playerId, tableId, lobby, buyIn, executor, botListeners);
  }

  @Override
  public void doNextAction() {
    GameState gameState = playerContext.getGameState();
    int deficit = gameState.getDeficit(HandBot.this.botId);

    int nbPlayers = 0;
    for(PlayerState p: gameState.getAllSeatedPlayers()){
      if(p.isActivelyPlaying()) nbPlayers++;
    }
   
    double winPercentage = getWinPercentage(gameState
        .getCommunityCards(), playerContext.getPocketCards(),
        100, nbPlayers - 1);
    if (logger.isDebugEnabled()) {
      logger.debug("Win percentage is " + winPercentage
          + " with " + playerContext.getPocketCards()
          + " and " + gameState.getCommunityCards() + " and "
          + (nbPlayers - 1) + " opponents.");
    }
    double EV = winPercentage
    * (gameState.getGamePotSize() + deficit);
    if (gameState.getRound().equals(Round.PREFLOP)) {
      // be more aggressive on the flop
      EV += EV;
    }
    try {
      if (gameState
          .getNextActivePlayerAfter(HandBot.this.botId) == null) {
        // can only call or fold
        if (deficit <= Math.round(EV)) {
          playerContext.checkOrCall();
        } else {
View Full Code Here

    } else {
      if (nrActions > threshold && !printed) {
        System.out.println("=================\nNEW BOT\n====================");
        printed = true;
      }
      GameState gameState = playerContext.getGameState();
      int deficit = gameState.getDeficit(getId());

      int nbPlayers = 0;
      for(PlayerState p: gameState.getAllSeatedPlayers()){
        if(p.isActivelyPlaying()) nbPlayers++;
      }
     
      double winPercentage = getWinPercentage(gameState
          .getCommunityCards(), playerContext.getPocketCards(),
          100, nbPlayers - 1);
      if (logger.isDebugEnabled()) {
        logger.debug("Win percentage is " + winPercentage
            + " with " + playerContext.getPocketCards()
            + " and " + gameState.getCommunityCards() + " and "
            + (nbPlayers - 1) + " opponents.");
      }
      double EV = winPercentage
      * (gameState.getGamePotSize() + deficit);
      if (gameState.getRound().equals(Round.PREFLOP)) {
        // be more aggressive on the flop
        EV += EV;
      }
      try {
        if (gameState
            .getNextActivePlayerAfter(getId()) == null) {
          // can only call or fold
          if (deficit <= Math.round(EV)) {
            playerContext.checkOrCall();
          } else {
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.