Package edu.villanova.studs.poker.transport

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


  }
 
  @Override
  public void buildCommunity() throws TransportException  {
    Card card = null;
    Table table = new Table();
    ArrayList<Card> communityCards = new ArrayList<Card>();

    for (int i = 1; i <= 5; i++) {
      card = convertValueToCard(req.getParameter("cc" + i));
      if (card.getRank() != TransportUtils.UNKNOWN
          && card.getSuit() != TransportUtils.UNKNOWN) {       
        communityCards.add(card);
               
        if (communityCards.size() != i) {
                                    throw new TransportException( PokerMessages.COMM_ORDER );
        }       
      }
    }

    table.setCommunity(communityCards);
               
    ((TableDataCommunity) pokerTable).setGameTable(table);
  }
View Full Code Here


           
            //Create an invalid table by adding 3 cards and removing one
            cards.add( new Card() );
            cards.add( new Card() );
            cards.add( new Card() );
            Table t = new Table();
           
            t.addCard( cards );
            t.removeCard(0);
            td.setGameTable( t );
            //Attempt to setup the engine with the invalid table data
            proph.setGameData( td );
        } catch (TransportException e) {
            fail( "An unexpeced error occured while setting up the SetGameData community  Test: " + e.getMessage() );
View Full Code Here

            //Create an invalid table by adding 3 cards and removing one
            cards.clear();
            cards.add( new Card() );
            cards.add( new Card() );
            cards.add( new Card() );
            Table t = new Table();
           
            t.addCard( cards );
            t.removeCard(0);
            td.setGameTable( t );
            //Attempt to setup the engine with the invalid table data
            proph.setGameData( td );
        } catch (TransportException e) {
            fail( "An unexpeced error occured while setting up the SetGameData community Test: " + e.getMessage() );
View Full Code Here

            p.addCard( new Card(1,2) );
            p.addCard( new Card(4,3) );
            td.addPlayer( p );
           
            //setup the table data so configuration will pass (execution will fail with dup card on the table)           
            Table t = new Table();
           
            td.setGameTable( t );
           
            proph.setOtherOptions( opts );
            proph.setGameData(td);
View Full Code Here

            p.addCard( new Card(1,2) );
            p.addCard( new Card(4,3) );
            td.addPlayer( p );
           
            //setup the table data so configuration will pass (execution will fail with dup card on the table)           
            Table t = new Table();
           
            td.setGameTable( t );
           
            proph.setOtherOptions( opts );
            proph.setGameData(td);
View Full Code Here

  }
 
  public static TableDataIntf buildTableData(ServletRequest req) throws TransportException {
   
            TableDataCommunity tableData = new TableDataCommunity();
            Table table = new Table();
            ArrayList<Card> communityCards = new ArrayList<Card>();
            Card tmpCard = null;
            Player tmpPlayer = null;
            String playerFold = null;

      int numOfPlayers = Integer.parseInt(req.getParameter(REQ_PARAM_NUM_PLAYERS));
      // loop through all the players
      for (int i = 1; i <= numOfPlayers; i++) {
              tmpPlayer = new Player();
              tmpCard = convertValueToCard(req.getParameter(getPlayerParamName(i, 1)));
              if (tmpCard.getRank() != TransportUtils.UNKNOWN
                              && tmpCard.getSuit() != TransportUtils.UNKNOWN) {
                      tmpPlayer.addCard(tmpCard);
              }

              tmpCard = convertValueToCard(req.getParameter(getPlayerParamName(i, 2)));
              if (tmpCard.getRank() != TransportUtils.UNKNOWN
                              && tmpCard.getSuit() != TransportUtils.UNKNOWN) {
                      tmpPlayer.addCard(tmpCard);
              }
             
              playerFold = req.getParameter(getPlayerFoldParamName(i));
              tmpPlayer.setFolded(REQ_VALUE_FOLD.equals(playerFold));

              tableData.addPlayer(tmpPlayer);
      }

      // loop through the community cards
      boolean stop = false;
      for (int i = 1; !stop && i <= 5; i++) {
              tmpCard = convertValueToCard(req.getParameter(getCommunityParamName(i)));
              if (tmpCard.getRank() != TransportUtils.UNKNOWN
                              && tmpCard.getSuit() != TransportUtils.UNKNOWN) {
                      communityCards.add(tmpCard);
              }
      }
      table.setCommunity(communityCards);
      tableData.setGameTable(table);

      // set the options
      Hashtable<String, Object> options = new Hashtable<String, Object>();
      int accuracyLevel = 1;
View Full Code Here

TOP

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

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.