public AnalystResult getPreFlopReaction(DataForStrategy dfs) {
AnalystResult analystResult = null;
Board board = dfs.getCurrentBoard();
float bbValue = board.getBigBlind();
float sbValue = board.getSmallBlind();
float leveledAmount = board.getLeveledAmount();
float bNeedToCallValue = board.needAmountToCall();
float raiseForLimpers = 0;
Hand heroHand = new Hand();
heroHand.setHandCards(board.getPlayingCards().getPlayerCards());
// TODO [SSS-PF] find limpers count;
int limpersCount = -1;
int raisersBefCount = -1;
for (Player player: board.getPlayers()){
if (FloatEx.equals4(player.getBet() - bbValue,0f))
limpersCount ++;
}
raiseForLimpers = FloatEx.cutFloat2(new Float(1.1 * bbValue *(4 + limpersCount) ) );
boolean isFirstCircle = true;
if (board.getPlayers().get(board.getHero()).getName().trim() == "")
isFirstCircle = true;
else
isFirstCircle = false;
int firstPlayerRaisePos = -1;
if (isFirstCircle) {
raisersBefCount = board.getNumOfRaises();
for (int i = 0; i< board.getPlayers().size() ; i++){
if (firstPlayerRaisePos == -1)
firstPlayerRaisePos = i;
}
if (raisersBefCount == 0){
int nSet = 0;
if (board.getHero() == board.getNextInGamePlayer(board.getNextInGamePlayer(board.getDealer())) &&
limpersCount == 1 && checkHandForHSet(heroHand,11))
return new AnalystResult(UIReaction.UIR_ACTION_RAISE, StringEx.float2str2(raiseForLimpers));
if (board.getHero() == board.getDealer() && limpersCount == 0 && checkHandForHSet(heroHand,9))
return new AnalystResult(UIReaction.UIR_ACTION_RAISE, StringEx.float2str2(raiseForLimpers));
if (board.getHero() == board.getNextInGamePlayer(board.getDealer()) && limpersCount == 0 && checkHandForHSet(heroHand,10))
return new AnalystResult(UIReaction.UIR_ACTION_RAISE, StringEx.float2str2(raiseForLimpers));
switch (board.getPosition()) {
case EARLY_POSITION: nSet = 1; break;
case MIDDLE_POSITION: nSet = 2; break;
case LAST_POSITION: nSet = 3; break;
case BLINDS: nSet = 3; break;
default: System.err.println("ERROR on count raise with limpers");
break;
}
if (checkHandForHSet(heroHand,nSet)){
if (dfs.getPlayerMoney() > raiseForLimpers)
return new AnalystResult(UIReaction.UIR_ACTION_RAISE, StringEx.float2str2(raiseForLimpers));
else
return new AnalystResult(UIReaction.UIR_ACTION_RAISE, StringEx.float2str2(dfs.getPlayerMoney()));
}else{
if (FloatEx.equals4(bNeedToCallValue,0f))
return new AnalystResult(UIReaction.UIR_ACTION_CHECK, "");
else
return new AnalystResult(UIReaction.UIR_ACTION_FOLD, "");
}
}else
if (raisersBefCount == 1){
if (checkHandForHSet(heroHand,1)){
return new AnalystResult(UIReaction.UIR_ACTION_RAISE, StringEx.float2str2(dfs.getPlayerMoney()));
}
// TODO analyze for re steal
// ReSteal may be when I'm at bb & Steel at lastPos
int tmpint = 0;
if (board.getNextInGamePlayer(board.getNextInGamePlayer(board.getDealer())) == board.getHero()){
tmpint = firstPlayerRaisePos;
for (int i = 0; i<3; i++)
{
tmpint = board.getNextInGamePlayer(tmpint);
if (tmpint == board.getHero() && checkHandForHSet(heroHand,2))
return new AnalystResult(UIReaction.UIR_ACTION_RAISE, StringEx.float2str2(dfs.getPlayerMoney()));
}
}
}else{
if (checkHandForHSet(heroHand,5)){