Examples of AnalystResult


Examples of com.poker.analyst.AnalystResult

    }
    if (reaction == UIReaction.UIR_ACTION_RAISE || reaction == UIReaction.UIR_ACTION_ALLIN) {
      if (playWnd.getCurrentEvent() == EventType.ET_ACTION_FOLD_ANY_RAISE) {

      } else if (playWnd.getCurrentEvent() == EventType.ET_ACTION_FOLD_CALL) {
        return new AnalystResult(UIReaction.UIR_ACTION_CALL, analystResult.getSurrogate());
      }
    }
    if (reaction == UIReaction.UIR_ACTION_CALL) {
      return analystResult;
    }
View Full Code Here

Examples of com.poker.analyst.AnalystResult

        Thread.sleep(100);
      } catch (final InterruptedException e1) {
        e1.printStackTrace();
      }

      pControl.react(pdata, playWnd, new AnalystResult(UIReaction.UIR_TAKE_BUYIN_SUMM, null));

      try {
        buyIn = pControl.getStringFromClipboard();
      } catch (final Exception e) {
        buyIn = "";
      }
      //    System.out.println(buyIn + " ");
      try{
        //if (pdata.getProgramSettings().getBuyInAmount().equals(Float.parseFloat(buyIn)) )
        if (pdata.getProgramSettings().getBuyInAmount()<= Float.parseFloat(buyIn) &&
            pdata.getProgramSettings().getBuyInAmount() * 1.10 >= Float.parseFloat(buyIn)) {
          pControl.react(pdata, playWnd, new AnalystResult(UIReaction.UIR_ACCEPT_BUYIN, null));
          playWnd.setCurrentEvent(EventType.ET_READY_FOR_GAME);
          System.out.println("yes");
        } else {
          pControl.killTableFromWaitingList(pdata, pControl, playWnd);
          pdata.getWaitingWindowList().remove(playWnd);
View Full Code Here

Examples of com.poker.analyst.AnalystResult

  public AnalystResult getReaction(DataForStrategy dfs){   
   
    if (dfs.getCurrentRound() == Rounds.PREFLOP){
      ActionBeforePlay abp = getPreparedAction(dfs);
      if (abp == ActionBeforePlay.ABP_CLOSEWINDOW){
        return new AnalystResult(UIReaction.UIR_CLOSE_WINDOW, "");
      }
    }
     
   
    switch (dfs.getCurrentRound()) {
View Full Code Here

Examples of com.poker.analyst.AnalystResult

    default:
      return null;
    }           
  }
  public AnalystResult adaptResult(AnalystResult analystResult,DataForStrategy dfs) {
    AnalystResult result = analystResult;
   
 
    if (analystResult == null){
      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);
View Full Code Here

Examples of com.poker.analyst.AnalystResult

  }

  @Override
  public AnalystResult isNeedRebuy(DataForStrategy dfs) {
    // TODO [SSS] need rebuy
    return new AnalystResult(null, null);
  }
View Full Code Here

Examples of com.poker.analyst.AnalystResult

  @Override
  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)){         
          return new AnalystResult(UIReaction.UIR_ACTION_RAISE, StringEx.float2str2(dfs.getPlayerMoney()));
        }               
      }       
    }
    else {
      if (checkHandForHSet(heroHand,6)){         
        return new AnalystResult(UIReaction.UIR_ACTION_RAISE, StringEx.float2str2(dfs.getPlayerMoney()));
      }     
    }
             
    if (limpersCount < 0)
      System.err.println("ERROR in counting limpers");
       
    return new AnalystResult(UIReaction.UIR_ACTION_FOLD, "");
  }
View Full Code Here

Examples of com.poker.analyst.AnalystResult

          else
            return new AnalystResult(UIReaction.UIR_ACTION_FOLD, "");
        }               
      }
      */
      return new AnalystResult(UIReaction.UIR_ACTION_FOLD, "");
     
  }
View Full Code Here

Examples of com.poker.analyst.AnalystResult

          else
            return new AnalystResult(UIReaction.UIR_ACTION_FOLD, "");
        } */              
    //  }
     
      return new AnalystResult(UIReaction.UIR_ACTION_FOLD, "");
    /*
    Board boardPrev = dfs.getPrevBoard();
    Board board     = dfs.getCurrentBoard();
    Card tmpcard = null;
    boolean wasRaiseOnPrevRound = false;       
View Full Code Here

Examples of com.poker.analyst.AnalystResult

          else
            return new AnalystResult(UIReaction.UIR_ACTION_FOLD, "");
        } */              
    //  }
     
      return new AnalystResult(UIReaction.UIR_ACTION_FOLD, "");
     
    /*Board boardPrev = dfs.getPrevBoard();
    Board board     = dfs.getCurrentBoard();
    Card tmpcard = null;
    boolean wasRaiseOnPrevRound = false;       
View Full Code Here

Examples of com.poker.analyst.AnalystResult

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

        PlayWindow currentplayWnd;
        Board board;
        AnalystResult analystResult;
        Boolean result;
        int temp;
 
        Logger logger = Logger.getLogger("General");
        FileHandler fh = new FileHandler("c:\\temp\\poker\\general.log", true);
        logger.addHandler(fh);
        logger.setLevel(Level.ALL);
        SimpleFormatter formatter = new SimpleFormatter();
        fh.setFormatter(formatter);

        Integer[] handles;
        /*int MainHandle = 7080878;
       
        temp = pControl.getProcID(pData.getRoomSettings().getProcessName());
        if (temp !=0) 
                pData.setProcID(temp);
       
        pData.setMainWnd(MainHandle,pControl.getWindowPosByHandle(MainHandle));
        */
        //              System.out.println("1: Fold, 2: Check, 3: Call, 4: Raise, 5: BuyIn, 6: SetBB, 7: WaitForBB   0: CLOSE");
        gbTimeCounter = System.currentTimeMillis();
       
        int counterForCloseEmptyWidows = 0;
        while (true) {
                if (System.currentTimeMillis() - gbTimeCounter >=gbTimeCounterDelay){
                        gbTimeCounter = System.currentTimeMillis();
                        System.gc();
                }
                counterForCloseEmptyWidows++;          
            int selector = 0;

            Thread.sleep(this.pData.getProgramSettings().getDelayMainThreadMs());
            if (this.pData.getMainWnd() == null) {
                if (this.pData.getProcID() == null) {
                    temp = this.pControl.getProcID(this.pData.getRoomSettings().getProcessName());
                    if (temp != 0) {
                        this.pData.setProcID(temp);
                    }
                }
                if (this.pData.getProcID() != null) {
                    handles = this.pControl.getOpenWindowsHandles(this.pData.getProcID());
                    this.pControl.RegMainWindow(this.pData, handles);
                }
            } else {
                handles = this.pControl.getOpenWindowsHandles(this.pData.getProcID());

                this.pControl.killDeadTablesFromPosition(this.pData, handles);
                this.pControl.updateWindowsFromWaitingList(this.pData);

                currentplayWnd = this.pControl.getPlayWindowReadyForAction(this.pData,true);
                if (currentplayWnd == null)
                        currentplayWnd = this.pControl.getPlayWindowReadyForAction(this.pData,false);
               
               
                if(counterForCloseEmptyWidows > 20){
                        counterForCloseEmptyWidows = 0;
                        try {
                                                this.pControl.getCloseEmptyWindows(this.pData);
                                        } catch (Exception e) {
                                                e.printStackTrace();
                                                continue;
                                        }
                }
               
                if (currentplayWnd != null) {
                        logger.log(Level.WARNING,currentplayWnd.getCurrentEvent().toString());
                        if (currentplayWnd.getCurrentEvent() == EventType.ET_NEED_WAIT_BB ){
                                analystResult = pControl.getReaction(pData, currentplayWnd);
                        }
                        else
                        if (currentplayWnd.getCurrentEvent() == EventType.ET_SYSTEM_MESSAGE ||
                                currentplayWnd.getCurrentEvent() == EventType.ET_SYSTEM_MESSAGE_2){
                               
                                        try {
                                                                analystResult = pControl.getReaction(pData, currentplayWnd);
                                                        } catch (Exception e) {
                                                                e.printStackTrace();
                                                                continue;
                                                        }
                        }
                        else
                        if (currentplayWnd.getCurrentEvent() == EventType.ET_SET_BB ){
                                try{
                                        currentplayWnd = pControl.fillNotFullBoardForBB(pData, currentplayWnd);
                                       
                                }catch (Exception e) {
                                        e.printStackTrace();
                                        continue;
                                                }
                               
                                analystResult = pControl.getReaction(pData, currentplayWnd);                           
                               
                        }else{                                                  
                                                                               
                       //       System.out.println(currentplayWnd.getCurrentEvent());
                            //Thread.sleep(1000);                                      
                                long time = System.currentTimeMillis();
                               
                                try{
                                        currentplayWnd = this.pControl.fillPlayWnd(this.pData, currentplayWnd);
                                }catch (Exception e) {
                                        e.printStackTrace();
                                        continue;
                                                }
                                time = System.currentTimeMillis() - time;                               
                            analystResult = pControl.getReaction(pData, currentplayWnd);
                            //logger.log(Level.WARNING,analystResult.toString());
                        }                      
                       
                    if (analystResult != null){
                        logger.log(Level.WARNING,analystResult.toString());
                        pControl.react(pData,currentplayWnd,analystResult);                    
                    }
               
                    currentplayWnd.setCurrentEvent(EventType.ET_IN_GAME);
                    continue;
                }
               
               
                if (this.pControl.isNewTableNeeds(this.pData) ) {
                    // openWindows     
                    if (this.pData.getWaitingWindowList().size() == 0 ) {
                        this.pControl.activateWindow(this.pData.getMainWnd());
                        EventType ev = this.pControl.getMainWindowEvent(this.pData, this.pControl);
                        if (ev != null) {
                        //    System.out.println(ev);
                            this.pControl.activateWindow(this.pData.getMainWnd());
                            this.pControl.react(this.pData, this.pData.getMainWnd(),
                                    new AnalystResult(UIReaction.UIR_MN_CLOSE_SYSTEM_WINDOW, null));
                        }
                        this.pControl.activateWindow(this.pData.getMainWnd());
                        this.pControl.react(this.pData, this.pData.getMainWnd(), new AnalystResult(
                                UIReaction.UIR_OPEN_WINDOW, null));
                        selector = 0;
                        while (selector < this.pData.getProgramSettings().getDelayOpenThreadMs()) {
                            selector += 500;
                            Thread.sleep(500);
                            if (handles.length < this.pControl.getOpenWindowsHandles(this.pData
                                    .getProcID()).length) {
                                break;
                            }
                            ev = this.pControl.getMainWindowEvent(this.pData, this.pControl);
                            if (ev != null) {
                              //  System.out.println(ev);
                                this.pControl.activateWindow(this.pData.getMainWnd());
                                this.pControl.react(this.pData, this.pData.getMainWnd(),
                                        new AnalystResult(UIReaction.UIR_MN_CLOSE_SYSTEM_WINDOW,
                                                null));
                              //  System.out.println("No due tables");
                                break;
                            }

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.