Package com.poker.analyst.combination

Examples of com.poker.analyst.combination.Flush


      if (card != null) allCards.add(card);
   
    return analyseFlushDraw(allCards, plCards);
  }
  public static List<Flush> analyseFlush(Set<Card> allCards, PlayingCards plCards){   
    Flush        comb       = null;
    List<Flush>     combinations = null;         
    List<Card>       combinationList;     
    Set<Card> allFlushCards       = null;
   
    int diamonds = 0;
    int clubs    = 0;
    int spades   = 0;
    int hearts   = 0;
   
    int count   = 0;
    Suit flushSuit = null;
   
    for (Card card: allCards){
      switch (card.getSuit()) {
        case clubs:    clubs++;  break;
        case diamonds:  diamonds++;  break;
        case spades:  spades++;  break;
        case hearts:  hearts++;   break;
        default:          break;   
      }
    }
    count = Math.max(Math.max(clubs, diamonds),Math.max(spades, hearts));   
    if (clubs    >= 5) flushSuit = Suit.clubs;
    else
    if (diamonds >= 5) flushSuit = Suit.diamonds;
    else
    if (spades    >= 5) flushSuit = Suit.spades;
    else
    if (hearts    >= 5) flushSuit = Suit.hearts;   
   
   
    int i = 0;
    Card firstCard = null;
    if (count >= 5){
      combinations = new ArrayList<Flush>();
     
      allFlushCards = new TreeSet<Card>(new CardComparator());
      for (Card card: allCards){
        if (card.getSuit().equals(flushSuit))
          allFlushCards.add(card);
      }     
     
      do{
        comb = new Flush();
        combinationList = new ArrayList<Card>();
        i = 0;
        firstCard = null;
        for (Card card: allFlushCards){
          if (i++ >4) break;
          if (firstCard == null)
            firstCard = card;
         
          combinationList.add(card);
         
        }         
        comb.setCombinationList(combinationList);   
        combinations.add(comb);
       
       
        allFlushCards.remove(firstCard);
      }while(allFlushCards.size() >=5 );
View Full Code Here


    }
   
    return combinations;
  }
  public static List<Flush> analyseFlushDraw(Set<Card> allCards, PlayingCards plCards){   
    Flush        comb       = null;
    List<Flush>     combinations = null;         
    List<Card>       combinationList;     
    Set<Card> allFlushCards       = null;
   
    int diamonds = 0;
    int clubs    = 0;
    int spades   = 0;
    int hearts   = 0;
   
    int count   = 0;
    Suit flushSuit = null;
   
    for (Card card: allCards){
      switch (card.getSuit()) {
        case clubs:    clubs++;  break;
        case diamonds:  diamonds++;  break;
        case spades:  spades++;  break;
        case hearts:  hearts++;   break;
        default:          break;   
      }
    }
    count = Math.max(Math.max(clubs, diamonds),Math.max(spades, hearts));   
    if (clubs    == 4) flushSuit = Suit.clubs;
    else
    if (diamonds == 4) flushSuit = Suit.diamonds;
    else
    if (spades    == 4) flushSuit = Suit.spades;
    else
    if (hearts    == 4) flushSuit = Suit.hearts;   
   
   
    int i = 0;
    Card firstCard = null;
    if (count == 4){
      combinations = new ArrayList<Flush>();
     
      allFlushCards = new TreeSet<Card>(new CardComparator());
      for (Card card: allCards){
        if (card.getSuit().equals(flushSuit))
          allFlushCards.add(card);
      }     
     
      do{
        comb = new Flush();
        combinationList = new ArrayList<Card>();
        i = 0;
        firstCard = null;
        for (Card card: allFlushCards){
          if (i++ >3) break;
          if (firstCard == null) firstCard = card;
          combinationList.add(card);
         
        }         
        comb.setCombinationList(combinationList);   
        combinations.add(comb);
       
        allFlushCards.remove(firstCard);
      }while(allFlushCards.size() >=4 );
    }   
View Full Code Here

    AvailableCombinationsTools act = new AvailableCombinationsTools(availcomb);
    Hand hand = new Hand(dfs.getCurrentBoard().getPlayingCards().getPlayerCards());
       
    Combination topCombination = act.getTopCombination();
   
    Flush    flushDraw     = act.analyzeFlush(true)
    Straight straightDraw  = act.analyzeStraight(true);
   
    if (availcomb.getFlushDraws() != null && availcomb.getFlushDraws().size() != 0 &&
      flushDraw == null)
      if (topCombination.getCombinationValue() < new Flush().getCombinationValue())
        topCombination = null;
    if (availcomb.getStraightOesds() != null && availcomb.getStraightOesds().size() != 0 &&
        straightDraw == null)
        if (topCombination.getCombinationValue() < new Straight().getCombinationValue())
          topCombination = null;
View Full Code Here

    AvailableCombinationsTools act = new AvailableCombinationsTools(availcomb);
    Hand hand = new Hand(dfs.getCurrentBoard().getPlayingCards().getPlayerCards());
       
    Combination topCombination = act.getTopCombination();
   
    Flush    flushDraw     = act.analyzeFlush(true)
    Straight straightDraw  = act.analyzeStraight(true);
   
    if (availcomb.getFlushDraws() != null && availcomb.getFlushDraws().size() != 0 &&
        flushDraw == null)
        if (topCombination.getCombinationValue() < new Flush().getCombinationValue())
          topCombination = null;
    if (availcomb.getStraightOesds() != null && availcomb.getStraightOesds().size() != 0 &&
        straightDraw == null)
        if (topCombination.getCombinationValue() < new Straight().getCombinationValue())
          topCombination = null;
View Full Code Here

    Hand hand = new Hand(dfs.getCurrentBoard().getPlayingCards().getPlayerCards());
       
    Combination topCombination = act.getTopCombination();
   
   
    Flush    flushDraw     = act.analyzeFlush(true)
    Straight straightDraw  = act.analyzeStraight(true);
   
    if (availcomb.getFlushDraws() != null && availcomb.getFlushDraws().size() != 0 &&
        flushDraw == null)
        if (topCombination.getCombinationValue() < new Flush().getCombinationValue())
          topCombination = null;
    if (availcomb.getStraightOesds() != null && availcomb.getStraightOesds().size() != 0 &&
        straightDraw == null)
        if (topCombination.getCombinationValue() < new Straight().getCombinationValue())
          topCombination = null;
View Full Code Here

    Combination comb = act.getTopCombination();
    //Hand hand = new Hand(dfs.getCurrentBoard().getPlayingCards().getPlayerCards());
   
    Combination topCombination = act.getTopCombination();
   
    Flush    flushDraw     = act.analyzeFlush(true)
    Straight straightDraw  = act.analyzeStraight(true);
   
    if (ta.m_ac.getFlushDraws() != null && ta.m_ac.getFlushDraws().size() != 0 &&
      flushDraw == null)
      if (topCombination.getCombinationValue() < new Flush().getCombinationValue())
        topCombination = null;
    if (ta.m_ac.getStraightOesds() != null && ta.m_ac.getStraightOesds().size() != 0 &&
        straightDraw == null)
        if (topCombination.getCombinationValue() < new Straight().getCombinationValue())
          topCombination = null;
View Full Code Here

TOP

Related Classes of com.poker.analyst.combination.Flush

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.