Examples of PlayerState


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

    super(gameState);
    this.event = event;
   
    final int newBetSize = super.getLargestBet();
   
    final PlayerState player = super.getPlayer(event.getPlayerId());
    final int chipsMoved = newBetSize - player.getBet();
    final int newStack = player.getStack() - chipsMoved;
   
    this.newPotSize = super.getRoundPotSize() + chipsMoved;
   
    playerState = new ForwardingPlayerState(player) {
     
View Full Code Here

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

  private final PlayerState playerState;
 
  public BlindState(GameState gameState, BlindEvent event) {
    super(gameState);
    this.event = event;
    PlayerState oldPlayerState = super.getPlayer(event.getPlayerId());
    final int newStack = oldPlayerState.getStack() - event.getAmount();
    this.newPot = super.getRoundPotSize() + event.getAmount();
   
    playerState = new ForwardingPlayerState(oldPlayerState) {
     
      @Override
View Full Code Here

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

  }

  @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

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

  @Override
  public GameState getStateAfterAction() throws GameEndedException,
      DefaultWinnerException {
    boolean roundEnds = true;
    Set<PlayerState> players = gameState.getAllSeatedPlayers();
    PlayerState first = null;
    boolean noDefaultWinner = false;
    // TODO use getNbPlayers()
    forloop: for (PlayerState player : players) {
      if (roundEnds && player.isActivelyPlaying()
          && !player.getPlayerId().equals(actor)
View Full Code Here

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

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

  /**
   * 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

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

      // 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

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

    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

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

  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

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

      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
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.