}
@Override
public AnalystResult getFlopReaction(DataForStrategy dfs) {
AvailableCombinations availcomb = new AvailableCombinations(dfs.getCurrentBoard().getPlayingCards());
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;
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);
}
Board board = dfs.getCurrentBoard();
Board boardPrev = dfs.getPrevBoard();
/*
if (!heroName.equals(board.getPlayers().get(board.getHero()).getName().trim())){
return new AnalystResult(UIReaction.UIR_ACTION_FOLD, "ONLYFOLD");
}*/
System.out.println(board.getCurrentRound()+ ": " + topCombination);
logger.log(Level.WARNING,"StrDraw: " + straightDraw);
logger.log(Level.WARNING,"FlushDraw: " + flushDraw);
// if on previous round hero stack was calculated incorrectly
if (board.getPlayers().get(board.getHero()).getStack() < board.getBigBlind() * 2)
return new AnalystResult(UIReaction.UIR_ACTION_RAISE , StringEx.float2str2(dfs.getPlayerMoney()));
boolean wasRaiseOnPrevRound = false;
boolean wasRaiseBeforeHero = false;
boolean isFirstCircle = false;
boolean wasRaiseHero = false;
wasRaiseOnPrevRound = !(FloatEx.equals4(boardPrev.getPlayers().get(boardPrev.getHero()).getBet(), boardPrev.getBigBlind()));
wasRaiseBeforeHero = !(FloatEx.equals4(board.getTotal(),0));
wasRaiseHero = !(FloatEx.equals4(board.getPlayers().get(board.getHero()).getBet(),0));
isFirstCircle = !(FloatEx.equals4(board.getPlayers().get(board.getHero()).getBet(),0)) ;
if (wasRaiseOnPrevRound){
if (topCombination instanceof Pair)
topCombination = act.analyzePair(topCombination,true,true,CardFace.FOUR,CardFace.JACK);
}else
{
if (topCombination instanceof Pair)
topCombination = act.analyzePair(topCombination,false,true,CardFace.JACK,CardFace.JACK);
}
float heroMoney = dfs.getPlayerMoney();
float total = dfs.getTotalBank();
float raiseAmount = 0f;
float koeff = 2.0f/3.0f;
//кто-то ререйзнул
List<CardValue> cardvalues;
if (wasRaiseHero ){
if (dfs.getPlayerMoney() > board.getPlayers().get(board.getHero()).getBet()){
if (availcomb.getAllCards().contains(new Card(Suit.clubs, CardFace.ACE)) ||
availcomb.getAllCards().contains(new Card(Suit.diamonds, CardFace.ACE)) ||
availcomb.getAllCards().contains(new Card(Suit.spades, CardFace.ACE)) ||
availcomb.getAllCards().contains(new Card(Suit.hearts, CardFace.ACE))){
if (topCombination instanceof Pair){
// if pair is middle && Ace exists => fold
//cardvalues = act.getCardValuesFromComb(topCombination, hand);