Examples of PokerPlayer


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

                return;
            }
            gameChanged(null); // update the current player in the label

           // open the command dialog to get the players commands
           PokerPlayer currentPlayer = (PokerPlayer) pc.getCurrentPlayer().getActualPlayer();

           // if the current player has folded, then advance to the next player.
           if (currentPlayer.hasFolded())  {
               pc.advanceToNextPlayer();
           }

           BettingDialog bettingDialog = new BettingDialog(pc, getParent());

           boolean canceled = bettingDialog.showDialog();
           if ( !canceled ) {
               PokerAction action = (PokerAction)currentPlayer.getAction(pc);
               applyPokerAction(action, currentPlayer);

               pc.advanceToNextPlayer();
           }
        }
View Full Code Here

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

    public GameOverMessage(PlayerList players) {
        buf = new StringBuilder("Game Over\n");

        // find the player with the most money. That's the winner.
        int max = -1;
        PokerPlayer winner = null;
        for (final Player p : players) {
            PokerPlayer pp = (PokerPlayer) p;
            if (pp.getCash() > max) {
                max = pp.getCash();
                winner = pp;
            }
        }
        assert winner != null;
        buf.append(winner.getName()).append(" won the game with $").append(winner.getCash()).append('.');
View Full Code Here

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

     * @return message to show if on client.
     */
    @Override
    protected String applyAction(PlayerAction action,  Player player) {

        PokerPlayer p = (PokerPlayer) player;
        PokerAction act = (PokerAction) action;
        PokerController pc = (PokerController) controller_;

        String msg = null;
        int callAmount = pc.getCurrentMaxContribution() - p.getContribution();
        PokerRound round = pc.getRound();

        switch (act.getActionName()) {
            case FOLD :
                p.setFold(true);
                msg = p.getName() + " folded.";
                break;
            case CALL :
                // GameContext.log(0,"PGV: robot call amount = currentMaxContrib - robot.getContrib) = "
                //                   + pc.getCurrentMaxContribution()+" - "+robot.getContribution());
                if (callAmount <= p.getCash())  {
                    p.contributeToPot(round, callAmount);
                    msg = p.getName() + " has called by adding "+ callAmount + " to the pot.";
                } else {
                    p.setFold(true);
                    msg = p.getName() + " folded.";
                }
                break;
            case RAISE :
                p.contributeToPot(round, callAmount);
                int raise = act.getRaiseAmount();
                p.contributeToPot(round, raise);
                msg = p.getName() + " has met the " + callAmount + ", and rasied the pot by " + raise;
                break;
        }
        return msg;
    }
View Full Code Here

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

     */
    public void showRoundOver(List<PokerPlayer> winners, int winnings) {

        PlayerList players = controller_.getPlayers();
        for (final Player p : players) {
            PokerPlayer player = (PokerPlayer) p.getActualPlayer();
            player.getHand().setFaceUp(true);
        }
        refresh();

        RoundOverDialog roundOverDlg = new RoundOverDialog(null, winners, winnings);

View Full Code Here

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

     * The default is to show nothing.
     */
    @Override
    protected void drawLastMoveMarker(Graphics2D g2, Player currentPlayer, Board board) {
         // draw a background circle for the player whose turn it is
        PokerPlayer player = (PokerPlayer) currentPlayer.getActualPlayer();
        PokerPlayerMarker m = player.getPiece();
        g2.setColor(PokerPlayerRenderer.HIGHLIGHT_COLOR);
        g2.fillOval(cellSize *(m.getLocation().getCol()-2),
                    cellSize *(m.getLocation().getRow()-2),
                    10* cellSize, 10* cellSize);
    }
View Full Code Here

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

        Point pos = getPosition(position, cellSize, pieceSize, margin);
        drawMarker(g2, playerMarker, pieceSize, pos);

        drawLabel(g2, cellSize, playerMarker, pieceSize, pos);

        PokerPlayer player = (PokerPlayer)playerMarker.getOwner();
        drawHand(g2, position, cellSize, player, pieceSize, pos);

        chipRenderer.render(g2, position.getLocation(), player.getCash(), cellSize);
    }
View Full Code Here

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

    public boolean isDone() {
        if (getLastMove() == null)
            return false;
        int numPlayersStillPlaying = 0;
        for (Player p : getPlayers()) {
            PokerPlayer player = (PokerPlayer) p.getActualPlayer();
            if (!player.isOutOfGame()) {
                numPlayersStillPlaying++;
            }
        }
        return (numPlayersStillPlaying == 1);
    }
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.