Examples of PokerPlayer


Examples of com.barrybecker4.game.multiplayer.poker.player.PokerPlayer

        for (Player p : players) {
            if (deck.size() < numCardsToDealToEachPlayer) {
                // ran out of cards. start a new shuffled deck.
                deck = new Deck();
            }
            PokerPlayer player = (PokerPlayer) p.getActualPlayer();
            player.setHand(new Hand(deck, numCardsToDealToEachPlayer));
            player.resetPlayerForNewRound();
        }
    }
View Full Code Here

Examples of com.barrybecker4.game.multiplayer.poker.player.PokerPlayer

     */
    public void anteUp(PlayerList players, int anteAmount) {
        // get players to ante up, if they have not already
        if (getPotValue() == 0) {
            for (Player p : players) {
                PokerPlayer player = (PokerPlayer) p.getActualPlayer();

                // if a player does not have enough money to ante up, he is out of the game
                player.contributeToPot(this, anteAmount);
            }
        }
    }
View Full Code Here

Examples of com.barrybecker4.game.multiplayer.poker.player.PokerPlayer

     * @return the maximum contribution made by any player so far this round
     */
    public int getCurrentMaxContribution(PlayerList players) {
       int max = Integer.MIN_VALUE;
        for (Player p : players) {
            PokerPlayer player = (PokerPlayer) p.getActualPlayer();
            if (player.getContribution() > max) {
                max = player.getContribution();
            }
        }
        return max;
    }
View Full Code Here

Examples of com.barrybecker4.game.multiplayer.poker.player.PokerPlayer

     */
    public int getAllInAmount(PlayerList players) {
        // loop through the players and return the min number of chips of any player
        int min = Integer.MAX_VALUE;
        for (Player p : players) {
            PokerPlayer player = (PokerPlayer) p.getActualPlayer();
            if (!player.hasFolded() && ((player.getCash() + player.getContribution()) < min)) {
                min = player.getCash() + player.getContribution();
            }
        }
        return min;
    }
View Full Code Here

Examples of com.barrybecker4.game.multiplayer.poker.player.PokerPlayer

        // special case of no one raising
        int contrib = getCurrentMaxContribution(players);
        GameContext.log(0, "in roundover check max contrib=" + contrib);

        for (Player pp : players) {
            PokerPlayer p = (PokerPlayer) pp.getActualPlayer();
            if (!p.hasFolded()) {
                assert(p.getContribution() <= contrib) :
                       "contrib was supposed to be the max, but " + p + " contradicats that.";
                if (p.getContribution() != contrib) {
                    return false;
                }
            }
        }
View Full Code Here

Examples of com.barrybecker4.game.multiplayer.poker.player.PokerPlayer

        PokerHandScorer scorer = new PokerHandScorer();
        HandScore bestScore = scorer.getScore(bestHand);

        // find the best hand
        for (int i = first + 1; i < players.size(); i++) {
            PokerPlayer player = (PokerPlayer) players.get(i).getActualPlayer();
            HandScore score = scorer.getScore(player.getHand());
            if (!player.hasFolded() && score.compareTo(bestScore) > 0) {
                bestScore = score;
            }
        }

        // find all players with a hand that good (rare that there will be more than one
        for (int i = first; i < players.size(); i++) {
            PokerPlayer player = (PokerPlayer) players.get(i).getActualPlayer();
            if (!player.hasFolded() && scorer.getScore(player.getHand()).compareTo(bestScore) == 0) {
                winners.add(player);
            }
        }

        GameContext.log(0, "The winning players were " + winners);
View Full Code Here

Examples of com.barrybecker4.game.multiplayer.poker.player.PokerPlayer

    private boolean allButOneFolded(PlayerList players) {

        int numNotFolded = 0;
        for (final Player pp : players) {
            PokerPlayer player = (PokerPlayer) pp.getActualPlayer();
            if (!player.hasFolded()) {
                numNotFolded++;
            }
        }
        return (numNotFolded == 1);
    }
View Full Code Here

Examples of com.barrybecker4.game.multiplayer.poker.player.PokerPlayer

     * @return  number of active players.
     */
    private int getNumNonFoldedPlayers(PlayerList players) {
        int count = 0;
        for (final Player p : players) {
            PokerPlayer player = (PokerPlayer) p.getActualPlayer();
            if (!player.isOutOfGame())
               count++;
        }
        return count;
    }
View Full Code Here

Examples of com.barrybecker4.game.multiplayer.poker.player.PokerPlayer

        double rowRad = getNumRows() >> 1;
        double colRad = getNumCols() >> 1;
        reset();
        for (final Player p : players) {

            PokerPlayer pp = (PokerPlayer) p.getActualPlayer();

            int row = (int) (0.93 * rowRad + (RADIUS * rowRad) * (Math.sin(angle)));
            int col = (int) (0.9 * colRad + (RADIUS * colRad) * (Math.cos(angle)));

            BoardPosition position = getPosition(row, col);
            position.setPiece(pp.getPiece());
            pp.getPiece().setLocation(position.getLocation());
            angle += angleIncrement;
        }
    }
View Full Code Here

Examples of com.barrybecker4.game.multiplayer.poker.player.PokerPlayer

        Color newColor = MultiGamePlayer.getNewPlayerColor(getPlayers());

        PokerOptions options = (PokerOptions) getGameOptions();
        String name = "Robot " + (i+1);
        PokerPlayer robot = PokerRobotPlayer.getRandomRobotPlayer(name, options.getInitialCash(), newColor);
        //SurrogateMultiPlayer sp = new SurrogateMultiPlayer(robot);
        this.addPlayer(robot);
    }
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.