Examples of Straight


Examples of com.poker.analyst.combination.Straight

                                  PlayingCards plCards,                        
                                  List<Pair> pairs,
                                  List<ThreeOfKind> threeOfKinds,
                                  List<FourOfKind> fourOfKinds, int numCards){

    Straight      comb       = null;
    List<Straight>     combinations = new ArrayList<Straight>();          
    List<Card>       combinationList;     
    List<Set<Card>> allStraightCardLists = null;
    Set<Card>     straightCardList    = null;
    List<CardFace> outFaces = null;
   

    List<CardFace> repeatedCards         = new ArrayList<CardFace>();
    if (pairs != null)
      for (Combination repeatedComb: pairs)
        repeatedCards.add(repeatedComb.getMaxValue());       
    if (threeOfKinds != null)
      for (Combination repeatedComb: threeOfKinds)
        repeatedCards.add(repeatedComb.getMaxValue());
    if (fourOfKinds != null)
      for (Combination repeatedComb: fourOfKinds)
        repeatedCards.add(repeatedComb.getMaxValue())

    allStraightCardLists = new ArrayList<Set<Card>>();   

    Set<Card> allNonRepCards = new TreeSet<Card>(new CardComparator());
    CardFace previousCard = null;

    for (Card card: allCards){
      if (card.getFace().equals(previousCard))
        continue;
      else
        previousCard = card.getFace();
     
      allNonRepCards.add(card);
    }
   
    int i = 0;
    int count = 0;
    int previous = 100;
    int position = -1;
   
    List<Integer> positions = new ArrayList<Integer>();
    do{
      i = 0;
      for (Card card: allNonRepCards){
        i++;
        if (position >= i ) continue;
        if (card.getFace().getSerialNumber() == previous - 1){
          previous--;
          count++;
        }
        else{
          previous = card.getFace().getSerialNumber();
          position = i;
          count = 1;   
        }
 
        if (count == numCards){
          positions.add(position);
          break;
        }       
      }
    }while(count == numCards);
   
    for (Integer pos: positions){
      i = 0;
      straightCardList = new TreeSet<Card>(new CardComparator());
      for (Card card: allNonRepCards){
        if (++i < pos) continue;
        if (card.getFace().equals(CardFace.ACE) && numCards == 4){
          straightCardList = null;
          break;
        }
        straightCardList.add(card);       
        if (i == pos + numCards - 1) break;
       
      }
      if (straightCardList != null)
      allStraightCardLists.add(straightCardList);
    }
   
    if (allStraightCardLists != null && allStraightCardLists.size() != 0){     
      for (Set<Card> straightsList : allStraightCardLists){
        comb = new Straight();
       
        combinationList = new ArrayList<Card>();
        for (Card card: straightsList)
          combinationList.add(card);
        comb.setCombinationList(combinationList);
        if(numCards == 4){
          outFaces = new ArrayList<CardFace>();
          outFaces.add(CardFace.getGetCardFaceFromNumber(comb.getMaxValue().getSerialNumber() + 1));
          if (comb.getMinValue().equals(CardFace.TWO))
            outFaces.add(CardFace.ACE);
          else
            outFaces.add(CardFace.getGetCardFaceFromNumber(comb.getMinValue().getSerialNumber() - 1));
         
          comb.setOutFaces(outFaces);
        }
        combinations.add(comb);
      }     
    }
    // Checking for (A- 2 3 4 5)
    if (numCards == 5){
      combinationList = new ArrayList<Card>();
      i = 0;
      int max = allNonRepCards.size() - 1;
      for (Card card: allNonRepCards){     
        if (i == 0 && card.getFace().equals(CardFace.ACE))
          combinationList.add(card);     
        if (i == max - 3 && card.getFace().equals(CardFace.FIVE) && numCards == 5)
          combinationList.add(card);
        if (i == max - 2 && card.getFace().equals(CardFace.FOUR))
          combinationList.add(card);
        if (i == max - 1 && card.getFace().equals(CardFace.THREE))
          combinationList.add(card);
        if (i == max && card.getFace().equals(CardFace.TWO))
          combinationList.add(card);       
        i++; 
      }
      if (combinationList.size() == numCards){
        comb = new Straight();     
        comb.setCombinationList(combinationList);
        combinations.add(comb);
      }   
    }
   
   
View Full Code Here

Examples of com.poker.analyst.combination.Straight

    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;
     
     
    topCombination = act.cutNotHeroCombination(topCombination);   
    if (topCombination != null){
View Full Code Here

Examples of com.poker.analyst.combination.Straight

    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;
     
   
    topCombination = act.cutNotHeroCombination(topCombination);   
      if (topCombination != null){
View Full Code Here

Examples of com.poker.analyst.combination.Straight

       
    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;
   
    topCombination = act.cutNotHeroCombination(topCombination);   
      if (topCombination != null){
             
View Full Code Here

Examples of com.poker.analyst.combination.Straight

    //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;
     
     
    topCombination = act.cutNotHeroCombination(topCombination);   
    if (topCombination != null){
View Full Code Here
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.