Package org.cspoker.client.common.playerstate

Examples of org.cspoker.client.common.playerstate.PlayerState


  public void showAction(final String action) {
    getChipsArea().setVisible(false);
    Rectangle chipsArea = getChipsArea().getBounds();
    getParent().redraw(chipsArea.x, chipsArea.y, chipsArea.width, chipsArea.height, true);
    getParent().update();
    PlayerState player = getGameState().getPlayer(playerId);
    playerStack.setText(ClientGUI.formatBet(player.getStack()));
    playerStack.pack(true);
    final String displayedName = name;
    playerName.setText(action);
    playerName.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
    getDisplay().timerExec(3000, new Runnable() {
View Full Code Here


  /**
   * Reset this {@link PlayerSeatComposite}, indicating an empty seat which
   * may be occupied by clicking on it
   */
  public void updatePlayerInfo() {
    PlayerState player = null;
    if (playerId != null) {
      player = getGameState().getPlayer(playerId);
    }
    String displayedName = (name == null) ? "Empty Seat" : name;
    if (player != null && false ) {//TODO !player.sitsIn()
      displayedName = displayedName.concat(" (Sitting Out)");
    }
    playerName.setText(displayedName);
    if (player == null) {
      name = null;
      return;
    }
    playerStack.setText(ClientGUI.formatBet(player.getStack()));
    playerStack.pack(true);
    holeCardsComposite.redraw();
    timerAction.cancel(true);
    layout(true);
  }
View Full Code Here

      // If not, we can probably sit in
      // TODO Buyin, reserve seat in the meantime
      logger.debug("Clicked on PlayerSeatComposite, sit in if empty ...");
      GameWindow containingGameWindow = getParent().getParent();
      UserSeatedPlayer user = containingGameWindow.getUser();
      PlayerState userSnapshot = getGameState().getPlayer(playerId);
      if (userSnapshot != null) {
        // Dont do anything if the user is already sitting in
        return;
      }
      int amount = new BuyinDialog(getClientCore(), user.getCashierContext(), containingGameWindow
View Full Code Here

    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()) {
      chipStacks.add(Chip.getDistribution(i));
    }
    return chipStacks;
  }
View Full Code Here

  protected int updateIntermediateRank(int rank, Card card) {
    return handRanks[card.ordinal() + 1 + rank];
  }

  public double getUpperWinBound() {
    PlayerState botState = gameState.getPlayer(botId);
    return gameState.getGamePotSize()+botState.getStack();
  }
View Full Code Here

      int maxDistributed = 0;
      int botInvestment = botState.getTotalInvestment();
      double sampleEV = 0;
      for (Iterator<PlayerState> iter = winDistributions.keySet().iterator(); iter.hasNext();) {
        PlayerState opponent = iter.next();
        int toDistribute = Math.min(botInvestment, opponent.getTotalInvestment())-maxDistributed;
        if(toDistribute>0){
          double pWin = 1;
          double pNotLose = 1;
          for (WinDistribution distribution : winDistributions.values()) {
            //you win when you win from every opponent
View Full Code Here

    context.betOrRaise(amount);
  }

  @Override
  public GameState getUnwrappedStateAfterAction() {
    PlayerState actorState = gameState.getPlayer(actor);
    int stack = actorState.getStack();
    int oldBet = actorState.getBet();
    int largestBet = gameState.getLargestBet();
    int deficit = largestBet - oldBet;
    int movedAmount = deficit + amount;

    GameState raiseState;
View Full Code Here

        .getNextActivePlayerAfter(actor).getPlayerId()));
  }

  @Override
  public String toString() {
    PlayerState actorState = gameState.getPlayer(actor);
    int stack = actorState.getStack();
    int oldBet = actorState.getBet();
    int largestBet = gameState.getLargestBet();
    int deficit = largestBet - oldBet;
    int movedAmount = deficit + amount;

    if (movedAmount >= stack) {
View Full Code Here

    }
//    List<Pot> pots = Collections.emptyList();
    NewRoundState newRoundState = new NewRoundState(lastState,
        new NewRoundEvent(nextRound, new Pots(lastState
            .getGamePotSize())));
    PlayerState firstToAct = newRoundState
        .getNextActivePlayerAfter(newRoundState.getDealer());
    if (firstToAct == null
        || newRoundState.getNextActivePlayerAfter(firstToAct
            .getPlayerId()) == null) {
      // no one/only one left
      return getNewRoundState(newRoundState);
    }
    return new NextPlayerState(newRoundState, new NextPlayerEvent(
        firstToAct.getPlayerId()));
  }
View Full Code Here

    context.checkOrCall();
  }
 
  @Override
  public GameState getUnwrappedStateAfterAction() {   
    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 {
View Full Code Here

TOP

Related Classes of org.cspoker.client.common.playerstate.PlayerState

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.