/** * Returns the opponent. From this, you can rerieve information about your opponent. * * @param me * @return */ public AbstractPlayer getOpponent(AbstractPlayer me) { for (AbstractPlayer player : players) { if (me.getName() != player.getName()) { return player; } } throw new IllegalArgumentException("List of players is malformed"); }
/** * Convenience method to get the total pot in the game * * @return */ public int getTotalPot() { logger.finest("Entering getTotalPot"); int totalPot = 0; for (AbstractPlayer player : players) { logger.finest(player.getName() + ":" + player.getPot()); totalPot += player.getPot(); } logger.finest("Pot: " + totalPot); return totalPot; }
/** * Return's opponent's bet, as a convenient method. If the opponent folds, checks, or calls, this * returns 0. Otherwise, it will return the amount that the player bet. * * @param me * @return */ public int getOpponentBet(AbstractPlayer me) { AbstractPlayer opponent = getOpponent(me); PlayerActivityRecord a = playerActivityRecords.get(playerActivityRecords.size() - 1); PlayerAction playerAction = a.getPlayerAction(); if (opponent.getName().equals(a.getName()) && (playerAction.getActionType() == ActionType.BET_OR_RAISE)) { return playerAction.getBet(); } else { return 0; } }
/** * Returns true if the player passed in is the big blind. * * @param me * @return */ public boolean isBigBlind(AbstractPlayer me) { return playerActivityRecords.get(1).getName().equals(me.getName()); }