@Override
 public void gameOverEvent(GameInfo gameInfo) {
   if (gameInfo.getNumPlayers() == 2) {
     PlayerInfo first = null;
     PlayerInfo second = null;
     for (int seat = 0; seat < gameInfo.getNumSeats(); seat++) {
       PlayerInfo player = gameInfo.getPlayer(seat);
       if (player != null) {
         if (player.getBankRoll() <= 0.001) {
           second = player;
         } else {
           first = player;
         }
       }
     }
     if (second != null) {
       rank.add(second);
       log.debug("Player " + second.getName() + " eliminated - " + rank.size());
       rank.add(first);
       log.debug("And the winner is: " + first.getName() + "!!");
     }
   } else {
     for (int seat = 0; seat < gameInfo.getNumSeats(); seat++) {
       PlayerInfo player = gameInfo.getPlayer(seat);
       if (player != null && player.getBankRoll() <= 0.001) {
         rank.add(player);
         log.debug("Player " + player.getName() + " eliminated - " + rank.size());
       }
     }
   }
 }
Exemple #2
0
 /** Requests an Action from the player Called when it is the Player's turn to act. */
 public Action getAction() {
   double toCall = gi.getAmountToCall(ourSeat);
   if (toCall == 0.0D) {
     return Action.checkAction();
   }
   return Action.callAction(toCall);
 }
Exemple #3
0
  @Override
  public Action getAction(Card c1, Card c2, GameInfo gi, int seat) {

    double toCall = gi.getAmountToCall(seat);

    // if you have pocket pairs, call
    if (c1.getRank() == c2.getRank()) {
      return Action.callAction(toCall);
    }

    // if both hole cards are bigger than 10, call
    if (c1.getRank() > Card.TEN && c2.getRank() > Card.TEN) {
      return Action.callAction(toCall);
    }

    // raise if both hole cards are within range of a straight
    if (Math.abs(c1.getRank() - c2.getRank()) < 4) {
      return Action.callAction(toCall);
    }

    return Action.checkOrFoldAction(toCall);
  }