Ejemplo n.º 1
0
  /** Posts blinds to the table's current small and big blind. */
  public void blinds() {
    int smallBlind = settings.getSmallBlind();
    PokerPlayer player = getSmallBlind();
    player.removeChips(smallBlind);
    player.raiseBet(smallBlind);
    pot.addChips(smallBlind);

    player = getBigBlind();
    int bigBlind = settings.getBigBlind();
    player.removeChips(bigBlind);
    player.raiseBet(bigBlind);
    pot.addChips(bigBlind);

    pot.raiseBet(bigBlind);
  }
Ejemplo n.º 2
0
  /**
   * Reveals player hands, awards payouts, then advances to hand end phase.
   *
   * @param reveal If remaining hands should be revealed
   */
  public void showdown(boolean reveal) {
    // Ensure table has 5 cards
    dealTableCards(5 - tableCards.size());

    if (reveal) {
      // Remaining players reveal hands
      revealHands();
    }

    // Compare hands and award payouts
    Map<PokerPlayer, Double> payouts = new HashMap<>();
    pot.calculatePayouts(payouts);
    awardPayouts(payouts);
    pot = null;

    handEnd();
  }
Ejemplo n.º 3
0
  @Override
  public void removePlayer(PokerPlayer player) {
    super.removePlayer(player);

    if (pot != null) {
      pot.removePlayer(player);
    }
    if (getPlayerCount() < settings.getMinPlayers()
        && !(phase == PokerPhase.STANDBY || phase == PokerPhase.HAND_END)) {
      stop();
    } else {
      switch (phase) {
        case PREFLOP:
        case FLOP:
        case TURN:
        case RIVER:
          betting();
      }
    }
  }