Package com.poker.analyst.element

Examples of com.poker.analyst.element.PlayingCards


    if (hand.getHandCards().length != 2) return null;
           
    return updateCVRangeInALL(combination, combination.getCardValues(hand));
  }
  public List<CardValue> updateCVRangeInALL(Combination combination, List<CardValue> cardValues){
    PlayingCards plCards = availableCombinations.getPlCards();
    if (cardValues == null)
      return cardValues;
    if (combination instanceof Pair      ||
      combination instanceof TwoPairs    || 
      combination instanceof ThreeOfKind ||
      combination instanceof FourOfKind  ||
      combination instanceof FourOfKind  ||
      combination instanceof FullHouse     ){
                 
      Set<Card> allCards = new TreeSet<Card>(new CardComparator());
      for (Card card: plCards.getPlayerCards())
        if (card != null) allCards.add(new Card(Suit.forAnalyse,card.getFace()));
      for (Card card: plCards.getTableCards())
        if (card != null) allCards.add(new Card(Suit.forAnalyse,card.getFace()));
     
     
           
      for (CardValue cv: cardValues){
View Full Code Here


    public static Board fillInBoard() {

        BoardGenerator.cardsList = generateCardsList();
        final Random random = new Random(new Date().getTime());
        final PlayingCards cards = fillInPlayingCards();
        final Board board = new Board();
        final List<Player> players = new ArrayList<Player>();
        Player player = null;
        final int playerCount = 2 + random.nextInt(8);
        for (int i = 0; i < playerCount; i++) {
View Full Code Here

        tableCards[0] = getCard();
        tableCards[1] = getCard();
        tableCards[2] = getCard();
        tableCards[3] = getCard();
        tableCards[4] = getCard();
        return new PlayingCards(playerCards, tableCards);
    }
View Full Code Here

    public static List<PlayerAction> parseString(final String clipBoard) {

        //      final TextTransfer textTransfer = new TextTransfer();
        //      final String clipBoard = textTransfer.getClipboardContents();
        final String[] arrClipBoard = clipBoard.split("\n");
        final PlayingCards playingCards = new PlayingCards();
        final List<PlayerAction> situation = new ArrayList<PlayerAction>();

        for (int i = arrClipBoard.length - 1; i > 0; i--) {
            if (arrClipBoard[i].startsWith(START_NEW_HAND)) {
                for (int j = arrClipBoard.length - 1; j > i; j--) {
                    if (arrClipBoard[j].startsWith(PLAYER)) {
                        // System.out.println("skip: " + arrClipBoard[j]);
                        continue;
                    }
                    if (arrClipBoard[j].equals(DEALER)) {
                        // System.out.println("skip: " + arrClipBoard[j]);
                        continue;
                    }
                    if (arrClipBoard[j].startsWith(DEALER)) {
                        final String[] tempStr = arrClipBoard[j].split(" ");
                        if (tempStr[2].equals(FOLD)) {
                            situation.add(new PlayerAction(Action.Fold, 0D,
                                    tempStr[PLAYER_POSITION]));
                            // System.out.println(tempStr[1] + " FOLD ");
                            continue;
                        }
                        if (tempStr[2].equals(CHECK)) {
                            situation.add(new PlayerAction(Action.Check, 0D,
                                    tempStr[PLAYER_POSITION]));
                            // System.out.println(tempStr[1] + " CHECK ");
                            continue;
                        }
                        if (tempStr[2].equals(ALLIN)) {
                            situation.add(new PlayerAction(Action.Raise, Double
                                    .parseDouble(tempStr[MONEY_POSITION_ALLIN].substring(1)),
                                    tempStr[PLAYER_POSITION]));
                            // System.out.println(tempStr[1] + " ALLIN ");
                            continue;
                        }
                        if (tempStr[2].equals(CALL)) {
                            situation.add(new PlayerAction(Action.Call, Double
                                    .parseDouble(tempStr[MONEY_POSITION_CALL].substring(1)),
                                    tempStr[PLAYER_POSITION]));
                            // System.out.println(tempStr[1] + " CALL " + tempStr[3]);
                            continue;
                        }
                        if (tempStr[2].equals(RAISE)) {
                            situation.add(new PlayerAction(Action.Raise, Double
                                    .parseDouble(tempStr[MONEY_POSITION_RAISE].substring(1)),
                                    tempStr[PLAYER_POSITION]));
                            // System.out.println(tempStr[1] + " RAISE " + tempStr[4]);
                            continue;
                        }
                        if (tempStr[2].equals(BET)) {
                            situation.add(new PlayerAction(Action.Bet, Double
                                    .parseDouble(tempStr[MONEY_POSITION_BET].substring(1)),
                                    tempStr[PLAYER_POSITION]));
                            // System.out.println(tempStr[1] + " BET " + tempStr[3]);
                            continue;
                        }
                        continue;
                    }

                    // end current turn
                    if (arrClipBoard[j].startsWith(DEALING)) {
                        if (arrClipBoard[j].startsWith(DEALING_PREFLOP)) {
                            System.out.println("Turn is preflop");
                            continue;
                        }
                        System.out.println("->Turn is " + arrClipBoard[j].substring(8));
                        break;
                    }

                    // your cards
                    if (arrClipBoard[j].startsWith(YOUR_CARDS)) {
                        // cards
                        final String[] arrCards = arrClipBoard[j].split(" ");
                        System.out.println("->Your card is " + parseCard(arrCards[2]) + " and "
                                + parseCard(arrCards[3]));
                        playingCards.getPlayerCards()[0] = parseCard(arrCards[2]);
                        playingCards.getPlayerCards()[1] = parseCard(arrCards[3]);
                        continue;
                    }

                    // cards
                    final String[] arrCards = arrClipBoard[j].split(" ");
                    if (arrCards.length == 3 || arrCards.length == 4 || arrCards.length == 5) {
                        System.out.print("->Table card is ");
                        for (int k = 0; k < arrCards.length; k++) {
                            playingCards.getTableCards()[k] = parseCard(arrCards[k]);
                            System.out.print(parseCard(arrCards[k]) + " ; ");
                        }
                        System.out.println();
                        continue;
                    }
View Full Code Here

        parserResult.setCurrentGameID(currentGameID);
        parserResult.setCurrentRound(currentRound);
       
       
        // ���������� ������� �����
        final PlayingCards plCards = new PlayingCards();
        Card[] retCards;
        final String arrHeroCards[] = heroCards.split(" ");
        if (arrHeroCards.length != 1) {
            retCards = new Card[arrHeroCards.length];
            for (int i = 0; i < arrHeroCards.length; i++) {
                retCards[i] = parseCard(arrHeroCards[i]);
            }
            plCards.setPlayerCards(retCards);
        }
       
       
        final String arrTableCards[] = tableCards.split(" ");
        if (arrTableCards.length != 1) {

            retCards = new Card[arrTableCards.length];
            for (int i = 0; i < arrTableCards.length; i++) {
                retCards[i] = parseCard(arrTableCards[i]);
            }
            plCards.setTableCards(retCards);
        }

        parserResult.setPlayingCards(plCards);       

        final Float deadMoney = 0f;
View Full Code Here

   
//    return new PlayingCards(heroCard, tableCard);

 

    PlayingCards plCards = new PlayingCards();
    plCards.setPlayerCards(new Card[]{new Card(Suit.clubs,CardFace.FIVE),
                           new Card(Suit.clubs,CardFace.SIX)});

    plCards.setTableCards(new Card[]{new Card(Suit.clubs,CardFace.SEVEN),
                     new Card(Suit.clubs,CardFace.FOUR),
                     new Card(Suit.hearts,CardFace.QUEEN)/*,                    
                     new Card(Suit.hearts,CardFace.QUEEN),
                     new Card(Suit.diamonds,CardFace.ACE)*/});

 
View Full Code Here

     
  }
 
  public static void main(String[] args) throws Exception {
           
    PlayingCards plCards = getPlayingCards(3);
   
    System.out.println("==================Player:================== ");
    for (Card card: plCards.getPlayerCards())
      System.out.println(card);
    System.out.println("==================TABLE:================== ");
    for (Card card: plCards.getTableCards())
      if (card != null) System.out.println(card);
    System.out.println("========================================== ");
   
   
   
View Full Code Here

        tableCards[0] = getCard();
        tableCards[1] = getCard();
        tableCards[2] = getCard();
        tableCards[3] = getCard();
        tableCards[4] = getCard();
        return new PlayingCards(playerCards, tableCards);
    }
View Full Code Here

   
    for (int i = 0; i<dim; i++)
      tableCard[i] = BoardGenerator.getCard(cardsList);
   
       
    return new PlayingCards(heroCard, tableCard);
  }
View Full Code Here

    return new PlayingCards(heroCard, tableCard);
  }
 
  public static void main(String[] args) throws Exception {
           
    PlayingCards plCards = getPlayingCards(3);
   
    System.out.println("==================Player:================== ");
    for (Card card: plCards.getPlayerCards())
      System.out.println(card);
    System.out.println("==================TABLE:================== ");
    for (Card card: plCards.getTableCards())
      if (card != null) System.out.println(card);
    System.out.println("========================================== ");
   
   
   
View Full Code Here

TOP

Related Classes of com.poker.analyst.element.PlayingCards

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.