Package com.poker.analyst.element

Examples of com.poker.analyst.element.Board


public class AnalystDelegate {

  public Board createBoardShablon(final PokerData pdata) {

    Board board = new Board();

    List<Player> players = new ArrayList<Player>();

    int countPlayers = pdata.getProgramSettings().getCountPlayers();

    for (int i = 0; i < countPlayers; i++) {
      //players.add(new Player(null, 0, 0, false));
      players.add(new Player());
    }
    for (Player pl:players){
      pl.setPlayerState(PlayerState.PRS_OTHER);
      pl.setBet(0);
      pl.setName("");
      pl.setReaction(null);
      pl.setStack(0f);
    }
   
    board.setDealer(0);
    board.setHero(0);

    board.setPlayers(players);
    //board.setPlayingCards(cards);

    return board;
  }
View Full Code Here


      System.err.println("ZERO ANSWER!!!!");
      return null;
    }
    String surrogate = analystResult.getSurrogate();
   
    Board board       = dfs.getCurrentBoard();
    float playerBet   = board.getPlayers().get(board.getHero()).getBet();
   
    
    if (analystResult.getReaction() == UIReaction.UIR_ACTION_CHECK){
      // TODO check
      board.setHeroActionOnTurn(HeroActionOnTurn.HAOT_CHECK);     
    }else
    if (analystResult.getReaction() == UIReaction.UIR_ACTION_FOLD){
      // TODO fold
      if (!surrogate.equals("ONLYFOLD") && FloatEx.equals(board.needAmountToCall(), 0, 0.001f)){
        board.setHeroActionOnTurn(HeroActionOnTurn.HAOT_CHECK);
        result = new AnalystResult(UIReaction.UIR_ACTION_CHECK, "");
      }     
      if (surrogate.equals("ONLYFOLD"))
        System.out.println("ONLYFOLD");
    }
    else
    if (analystResult.getReaction() == UIReaction.UIR_ACTION_RAISE){
      Float ft = Float.parseFloat(surrogate);
      //board.setHeroActionOnTurn(HeroActionOnTurn.HAOT_RAISE);
     
      if (FloatEx.gt4(board.needAmountToCall(), ft) ||
          FloatEx.equals4(board.needAmountToCall(), ft)){
        board.setHeroActionOnTurn(HeroActionOnTurn.HAOT_CALL);
        result = new AnalystResult(UIReaction.UIR_ACTION_CALL, "");
      }else
      if (FloatEx.equals4(ft, board.getPlayers().get(board.getHero()).getStack())){
        //result = new AnalystResult(UIReaction.UIR_ACTION_RAISE, StringEx.float2str2(ft + board.needAmountToCall()));               
        result = new AnalystResult(UIReaction.UIR_ACTION_ALLIN, StringEx.float2str2(ft + board.needAmountToCall()));
      }     
    }
    else
    if (analystResult.getReaction() == UIReaction.UIR_ACTION_CALL){     
      board.setHeroActionOnTurn(HeroActionOnTurn.HAOT_CALL);
    }   
   
    return result;
  }
View Full Code Here

    }

    public boolean maySitToTable(DataForStrategy dfs){   
    boolean result = true;
   
    Board board = dfs.getCurrentBoard();
   
    int countSssPlayers = 0;
    for (Player player: board.getPlayers()){
      if (FloatEx.gt4( board.getPlayers().get(board.getHero()).getStack(),player.getStack())){
        countSssPlayers++;
      }
    }
    if (countSssPlayers > 5){
      result = false;
View Full Code Here

   
    return result;
  }
 
  public ActionBeforePlay getPreparedAction(DataForStrategy dfs){
    Board board = dfs.getCurrentBoard();
    // CLOSEWINDOW   
    if (FloatEx.gt4(board.getPlayers().get(board.getHero()).getStack(),1.25f * board.getBigBlind() * 30)){
      System.err.println("hero have mush money");
      return ActionBeforePlay.ABP_CLOSEWINDOW;
    }

    if (board.getInGamePlayers() < 7){
      System.err.println("numPlayers < 7");
      return ActionBeforePlay.ABP_CLOSEWINDOW;
    }
   
    int countSssPlayers = 0;
    for (Player player: board.getPlayers()){
      if (FloatEx.gt4(30 * board.getBigBlind(),player.getStack())){
        countSssPlayers++;
      }
    }
    if (countSssPlayers > 5){
      System.err.println("SSS players > 5");
View Full Code Here

  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)){         
View Full Code Here


    ParserResult     parserResult = null;
    ParserResult     parserResultPrev = null;

    Board board     = pControl.createBoardShablon(pdata);
    board       = prerareBoard(board, 10, 0, 9, 0.2f);
    board.getPlayers().get(0).setStack(6.0f);
   

    Board boardPrev = null;
    Board boardPrevNew = null;

    try {           
      parserResult = bufferParser.getParserResult(strBuffer,null);

      if (parserResult.getCurrentRound() != Rounds.PREFLOP){
        boardPrevNew = pControl.createBoardShablon(pdata);
        boardPrevNew = prerareBoard(boardPrevNew, 10, 0, 9, 0.2f);
        boardPrevNew.getPlayers().get(0).setStack(4.9f);
        switch (parserResult.getCurrentRound()) {
        case FLOP:
          parserResultPrev = bufferParser.getParserResult(strBuffer,Rounds.PREFLOP);
          break;
        case TURN:
          parserResultPrev = bufferParser.getParserResult(strBuffer,Rounds.FLOP);
          break;
        case RIVER:
          parserResultPrev = bufferParser.getParserResult(strBuffer,Rounds.TURN);
          break;       
        }        
        if (parserResultPrev == null) throw new Exception("prev buffer taking exception");
      }           
    } catch (final Exception e) {
      System.err.println("buffer taking exception");
      e.printStackTrace();
      return null;
    }
    playWnd.setCurrentRound(parserResult.getCurrentRound());
    switch(parserResult.getCurrentRound()){
      case PREFLOP :
        playWnd.setPreflopBoard(null);
        playWnd.setFlopBoard(null);
        playWnd.setTurnBoard(null);
        playWnd.setRiverBoard(null);
        break;
      case FLOP :
        boardPrev = playWnd.getPreflopBoard();
        break;
      case TURN :
        boardPrev = playWnd.getFlopBoard();
        break;
      case RIVER :
        boardPrev = playWnd.getTurnBoard();
        break;
    }

    if (parserResult.getCurrentRound() != Rounds.PREFLOP){
      for (int i = 0; i< boardPrev.getPlayers().size() ; i++)
        boardPrevNew.getPlayers().get(i).setPlayerState(boardPrev.getPlayers().get(i).getPlayerState());
      boardPrevNew.setCurrentRound(boardPrev.getCurrentRound());
    }
    if (boardPrevNew != null){
          boardPrevNew.setDealer(board.getDealer());
          //boardPrevNew = pControl.setNamesToBoard(boardPrevNew,bufferParser.getPlayersName(strBuffer));
          boardPrevNew = pControl.setParserResultsToBoard(pdata, pControl, boardPrevNew, parserResultPrev);
        }

    //board = pControl.setNamesToBoard(board,bufferParser.getPlayersName(strBuffer));                      
View Full Code Here

        //      owThread.start();
        //      pwThread.start();

        PlayWindow currentplayWnd;
        Board board;
        AnalystResult analystResult;
        Boolean result;
        int temp;
 
        Logger logger = Logger.getLogger("General");
View Full Code Here

import com.poker.control.PokerControl;
import com.poker.ui.windows.PlayWindow;

public class ViewBoard {
  public static void viewBoard(PlayWindow playWnd, Rounds round, PokerControl pControl){
    Board board = null;
    if (pControl == null)
      pControl = new PokerControl();
    switch (round) {
      case FLOP:    board = playWnd.getFlopBoard()
        break;
      case PREFLOP: board = playWnd.getPreflopBoard()
        break;
      case TURN:    board = playWnd.getTurnBoard();
        break;
      case RIVER:    board = playWnd.getRiverBoard();
        break
               
    }
   
    //Painting The Board
        if (board.getPlayingCards() != null) {
            System.out.print("HCards: ");
            if (board.getPlayingCards().getPlayerCards() != null) {
                for (final Card card : board.getPlayingCards().getPlayerCards()) {
                    System.out.print(card + ", ");
                }
            }
            System.out.println();

            if (board.getPlayingCards().getTableCards() != null) {
                System.out.print("TCards: ");
            }
            for (final Card card : board.getPlayingCards().getTableCards()) {
                System.out.print(card + ", ");
            }
            System.out.println();
            if (board.getBlindPlayers() != null)
              for (Player pl: board.getBlindPlayers()){
                System.out.println(pl.getName() + ": " + pl.getBet());
              }
           
            System.out.println("Dead blinds: " + board.getDeathBlind());
            System.out.println("-----------------------------------");
                       
        }
        System.out.println("RType : " + board.getCurrentRound());
               
        System.out.println("Total : " + pControl.getAllRoundTotal(playWnd));
        System.out.println("------Board-----------------------------");
        Player player;
        for (int i = 0; i < board.getPlayers().size(); i++) {
            player = board.getPlayers().get(i);
            System.out.print(i + ": ");
            if (board.getDealer() == i) {
                System.out.print(" D ");
            } else {
                System.out.print("   ");
            }
View Full Code Here

TOP

Related Classes of com.poker.analyst.element.Board

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.