Package com.poker.analyst.test.combination

Source Code of com.poker.analyst.test.combination.TestAvailableCombinations

package com.poker.analyst.test.combination;

import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import com.poker.analyst.analyser.CardComparator;
import com.poker.analyst.combination.AvailableCombinations;
import com.poker.analyst.combination.AvailableCombinationsTools;
import com.poker.analyst.combination.Combination;
import com.poker.analyst.combination.Flush;
import com.poker.analyst.combination.HighCard;
import com.poker.analyst.combination.Straight;
import com.poker.analyst.combination.TwoPairs;
import com.poker.analyst.combinations.auxil.CardValue;
import com.poker.analyst.element.Card;
import com.poker.analyst.element.Hand;
import com.poker.analyst.element.PlayingCards;
import com.poker.analyst.test.TestOdds;

public class TestAvailableCombinations {
  AvailableCombinations m_ac;
  PlayingCards plCards;

  public void viewCards(){
    System.out.println("==================BASIC:================== ");
    for (Card card: plCards.getPlayerCards())
      System.out.print(card + "  ");
    System.out.println();
    for (Card card: plCards.getTableCards())
      if (card != null) System.out.print(card + "  ");
    System.out.println();   
    System.out.println("------------------- ALL------------------- ");
    Set<Card> allCards = new TreeSet<Card>(new CardComparator());
    for (Card card: plCards.getPlayerCards())
      if (card != null) allCards.add(card);
    for (Card card: plCards.getTableCards())
      if (card != null) allCards.add(card);
   
    for (Card card: allCards)
      if (card != null) System.out.print(card + "  ");
    System.out.println();
   
   
  }
  public void viewCombinations(){
    if (m_ac.getHighCard() != null){
      System.out.println("================== HighCard:================== ");
      for(Combination comb: m_ac.getHighCard()){
        System.out.println(comb);
      }
    }
    if (m_ac.getPairs() != null){
      System.out.println("================== Pairs:================== ");
      for(Combination comb: m_ac.getPairs()){
        System.out.println(comb);
      }
    }
    if (m_ac.getTwoPairs() != null){
      System.out.println("================== TwoPairs:================== ");
      for(Combination comb: m_ac.getTwoPairs()){
        System.out.println(comb);
      }
    }
    if (m_ac.getThreeOfKinds() != null){
      System.out.println("================== 3 of kind:================== ");
      for(Combination comb: m_ac.getThreeOfKinds()){
        System.out.println(comb);
      }
    }
    if (m_ac.getFourOfKinds() != null){
      System.out.println("================== 4 of kind:================== ");
      for(Combination comb: m_ac.getFourOfKinds()){
        System.out.println(comb);
      }
    }
    if (m_ac.getFlushs() != null){
      System.out.println("================== Flush:================== ");
      for(Combination comb: m_ac.getFlushs()){
        System.out.println(comb);
      }
    }   
    if (m_ac.getFlushDraws() != null){
      System.out.println("================== FlushDraws:================ ");
      for(Combination comb: m_ac.getFlushDraws()){
        System.out.println(comb);
      }
    }
   
    if (m_ac.getStraights() != null){
      System.out.println("================== Straight:================== ");
      for(Combination comb: m_ac.getStraights()){
        System.out.println(comb);
      }
    }
    if (m_ac.getStraightOesds() != null){
      System.out.println("================== StraightOESD:============== ");
      for(Combination comb: m_ac.getStraightOesds()){
        System.out.println(comb);
      }
    }   
    if (m_ac.getStraightGhs() != null){
      System.out.println("================== StraightGH:============== ");
      for(Combination comb: m_ac.getStraightGhs()){
        System.out.println(comb);
      }
    }
    if (m_ac.getFullHouses() != null){
      System.out.println("================== FullHouse :============== ");
      for(Combination comb: m_ac.getFullHouses()){
        System.out.println(comb);
      }
    }
    if (m_ac.getStraightFlushes() != null){
      System.out.println("================== StraightFlush :============== ");
      for(Combination comb: m_ac.getStraightFlushes()){
        System.out.println(comb);
      }
    }
  }

  public static void main(String[] args) {
   
   
    TestAvailableCombinations ta = new TestAvailableCombinations();
    int i = 0
    do{
      i++;
      ta.plCards = TestOdds.getPlayingCards(5);
      ta.m_ac = new AvailableCombinations(ta.plCards);

    }while(ta.m_ac.getStraightOesds() == null && false);
    //}while(ta.m_ac.getFullHouses() == null || ta.m_ac.getFullHouses().size() < 2);     
    ta.viewCards();
    ta.viewCombinations();
    System.out.println("=================TopCombination========================= ");
    //System.out.println("op= " + i);
    AvailableCombinationsTools act = new AvailableCombinationsTools(ta.m_ac)
    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;
     
     
    topCombination = act.cutNotHeroCombination(topCombination);   
    if (topCombination != null){
             
      if (topCombination instanceof HighCard)
        topCombination = null;
     
      if (topCombination instanceof Flush)
        topCombination = act.analyzeFlush(false);
      else
      if (topCombination instanceof Straight)
        topCombination = act.analyzeStraight(false);   
      if (topCombination instanceof TwoPairs)
        topCombination = act.analyzeTwoPair(topCombination,true);   
     
     
    }
    
    System.out.println("TopCombinat : " + topCombination);
    System.out.println("FlushDraw   : " + flushDraw);
    System.out.println("StraightDraw: " + straightDraw);
   
 

  public AvailableCombinations CountAvailableCombinations(PlayingCards plCards){
    AvailableCombinations m_ac = new AvailableCombinations(plCards);
   
    return m_ac;
  }


}
TOP

Related Classes of com.poker.analyst.test.combination.TestAvailableCombinations

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.