Package edu.villanova.studs.poker.transport

Examples of edu.villanova.studs.poker.transport.Card


  @Override
  public void buildDealtHands() throws TransportException {
    List<Player> players = pokerTable.getPlayers();
    Player player = null;
    Card card = null;
    String playerFold = null;
    int numActive = 0;
    for (int i = 1; i <= players.size(); i++) {
      player = players.get(i - 1);
      card = convertValueToCard(req.getParameter("p" + i + "c1"));
      if (card.getRank() != TransportUtils.UNKNOWN
          && card.getSuit() != TransportUtils.UNKNOWN) {
        player.addCard(card);
      }

      card = convertValueToCard(req.getParameter("p" + i + "c2"));
      if (card.getRank() != TransportUtils.UNKNOWN
          && card.getSuit() != TransportUtils.UNKNOWN) {
        player.addCard(card);
      }

     
      if (player.getCards().size() == 1) {
View Full Code Here


   * @return - A Card instance
   * @throws TransportException - Thrown when the value cannot be properly
   * converted to a Card instance
   */
  private static Card convertValueToCard(String value) throws TransportException {
    Card card = new Card();
    if (value != null && !"".equals(value)
        && (value.length() == 2 || value.length() == 3)) {
      String suit = value.substring(0, 1);
      String rank = value.substring(1, value.length());

      if (PARAM_SUIT_DIAMONDS.equals(suit)) {
        card.setSuit(TransportUtils.DIAMONDS);
      } else if (PARAM_SUIT_CLUBS.equals(suit)) {
        card.setSuit(TransportUtils.CLUBS);
      } else if (PARAM_SUIT_SPADES.equals(suit)) {
        card.setSuit(TransportUtils.SPADES);
      } else if (PARAM_SUIT_HEARTS.equals(suit)) {
        card.setSuit(TransportUtils.HEARTS);
      }

      if (PARAM_RANK_TWO.equals(rank)) {
        card.setRank(TransportUtils.TWO);
      } else if (PARAM_RANK_THREE.equals(rank)) {
        card.setRank(TransportUtils.THREE);
      } else if (PARAM_RANK_FOUR.equals(rank)) {
        card.setRank(TransportUtils.FOUR);
      } else if (PARAM_RANK_FIVE.equals(rank)) {
        card.setRank(TransportUtils.FIVE);
      } else if (PARAM_RANK_SIX.equals(rank)) {
        card.setRank(TransportUtils.SIX);
      } else if (PARAM_RANK_SEVEN.equals(rank)) {
        card.setRank(TransportUtils.SEVEN);
      } else if (PARAM_RANK_EIGHT.equals(rank)) {
        card.setRank(TransportUtils.EIGHT);
      } else if (PARAM_RANK_NINE.equals(rank)) {
        card.setRank(TransportUtils.NINE);
      } else if (PARAM_RANK_TEN.equals(rank)) {
        card.setRank(TransportUtils.TEN);
      } else if (PARAM_RANK_JACK.equals(rank)) {
        card.setRank(TransportUtils.JACK);
      } else if (PARAM_RANK_QUEEN.equals(rank)) {
        card.setRank(TransportUtils.QUEEN);
      } else if (PARAM_RANK_KING.equals(rank)) {
        card.setRank(TransportUtils.KING);
      } else if (PARAM_RANK_ACE.equals(rank)) {
        card.setRank(TransportUtils.ACE);
      }
    }

    return card;
  }
View Full Code Here

TOP

Related Classes of edu.villanova.studs.poker.transport.Card

Copyright © 2018 www.massapicom. 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.