Package com.poker.test

Source Code of com.poker.test.ViewBoard

package com.poker.test;

import com.poker.analyst.element.Board;
import com.poker.analyst.element.Card;
import com.poker.analyst.element.Player;
import com.poker.analyst.element.Rounds;
import com.poker.control.PokerControl;
import com.poker.ui.windows.PlayWindow;

public class ViewBoard {
  public static void viewBoard(PlayWindow playWnd, Rounds round, PokerControl pControl){
    Board board = null;
    if (pControl == null)
      pControl = new PokerControl();
    switch (round) {
      case FLOP:    board = playWnd.getFlopBoard()
        break;
      case PREFLOP: board = playWnd.getPreflopBoard()
        break;
      case TURN:    board = playWnd.getTurnBoard();
        break;
      case RIVER:    board = playWnd.getRiverBoard();
        break
               
    }
   
    //Painting The Board
        if (board.getPlayingCards() != null) {
            System.out.print("HCards: ");
            if (board.getPlayingCards().getPlayerCards() != null) {
                for (final Card card : board.getPlayingCards().getPlayerCards()) {
                    System.out.print(card + ", ");
                }
            }
            System.out.println();

            if (board.getPlayingCards().getTableCards() != null) {
                System.out.print("TCards: ");
            }
            for (final Card card : board.getPlayingCards().getTableCards()) {
                System.out.print(card + ", ");
            }
            System.out.println();
            if (board.getBlindPlayers() != null)
              for (Player pl: board.getBlindPlayers()){
                System.out.println(pl.getName() + ": " + pl.getBet());
              }
           
            System.out.println("Dead blinds: " + board.getDeathBlind());
            System.out.println("-----------------------------------");
                       
        }
        System.out.println("RType : " + board.getCurrentRound());
               
        System.out.println("Total : " + pControl.getAllRoundTotal(playWnd));
        System.out.println("------Board-----------------------------");
        Player player;
        for (int i = 0; i < board.getPlayers().size(); i++) {
            player = board.getPlayers().get(i);
            System.out.print(i + ": ");
            if (board.getDealer() == i) {
                System.out.print(" D ");
            } else {
                System.out.print("   ");
            }

            System.out.format("%20s  ", player.getName());
            if (player.getStack() != -1) {
                System.out.format("%5.2f", player.getStack());
            } else {
                System.out.format("    ");
            }
            switch (player.getPlayerState()) {
            case PRS_IN_ACTION:
                System.out.print(" ++ ");
                break;
            case PRS_FOLD:
                System.out.print(" F  ");
                break;
            case PRS_SITOUT:
                System.out.print(" _  ");
                break;
            case PRS_NONE:
                System.out.print("    ");
                break;
            default:
                System.out.print(" O  ");
                break;
            }
            if (player.getBet() != 0) {
                System.out.format("%5.2f", player.getBet());
            } else {
                System.out.format("    ");
            }

            System.out.print("  " + player.getReaction());
            System.out.println();
        }
        System.out.println("================================");
  }
}
TOP

Related Classes of com.poker.test.ViewBoard

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.