Examples of PlayWindow


Examples of com.poker.ui.windows.PlayWindow

  public static void main(String[] args) throws Exception {
    PokerControl pControl = new PokerControl();
    Strategy strategy = new SSSStrategy1("");
    DataForStrategy dfs = new DataForStrategy();
   
    PlayWindow playWnd = PlayWindowFactory.getPlayWindow();
    playWnd = FillPlayWindow.fillPlayWindow(playWnd, bPathPF);
  //  ViewBoard.viewBoard(playWnd, playWnd.getCurrentRound(), null);
    dfs.setCurrentBoard(playWnd.getCurrentBoard());
    dfs.setCurrentRound(playWnd.getCurrentRound());
    /* not realized yet
      dfs.setPlayerMoney(playWnd.getPlayerMoney());
    */
    //  0 - hero place
    dfs.setPlayerMoney(dfs.getCurrentBoard().getPlayers().get(0).getStack());
    dfs.setTotalBank(pControl.getAllRoundTotal(playWnd));
           
  //  System.out.println("Preflop board: "+ playWnd.getPreflopBoard());
    ViewBoard.viewBoard(playWnd, Rounds.PREFLOP, pControl);
   
    AnalystResult aResult = strategy.getReaction(dfs);
    System.out.println(aResult);
   
    System.out.println("//////////////////==========================================");
       playWnd = FillPlayWindow.fillPlayWindow(playWnd, bPathF);
       System.out.println("Preflop board2: " + playWnd.getPreflopBoard());
       System.out.println("flop    board : " + playWnd.getFlopBoard());      
      
       List<Player> player = playWnd.getFlopBoard().getPlayers();
       for(int i = 0; i<10;i++)
         if (i != 0 && i!= 8){
           player.get(i).setPlayerState(PlayerState.PRS_FOLD);
           player.get(i).setReaction(UIReaction.UIR_ACTION_FOLD);
         }
          
//     ViewBoard.viewBoard(playWnd, Rounds.PREFLOP, null);      
      ViewBoard.viewBoard(playWnd, playWnd.getCurrentRound(), null);     
   
    dfs.setCurrentBoard(playWnd.getCurrentBoard());
    dfs.setCurrentRound(playWnd.getCurrentRound());
    dfs.setPlayerMoney(dfs.getCurrentBoard().getPlayers().get(0).getStack());
    dfs.setTotalBank(pControl.getAllRoundTotal(playWnd));
    dfs.setPrevBoard(playWnd.getPreflopBoard());
   
    aResult = strategy.getReaction(dfs);
    System.out.println(aResult);
   
   
View Full Code Here

Examples of com.poker.ui.windows.PlayWindow

        Boolean bIsEmpty = false;
       
        int topX;
        int topY;
        WindowPosition wpos;
        PlayWindow playWnd = null;
       
        Boolean[] activePlayers;
        Boolean[] sitoutPlayers;
        Boolean[] emptyPlaces;
        Boolean[] foldPlayers;
       
        int nCount;

        for (int i = 0; i < winPositions.size(); i++) {
          nCount = 0;
            wpos = winPositions.get(i);
            if (wpos.getPlayWindow() != null) {
              playWnd = wpos.getPlayWindow();
                pcontrol.activateWindow(playWnd);
                try {
                    Thread.sleep(200);
                } catch (final InterruptedException e) {
                    e.printStackTrace();
                }
                topX = playWnd.getLeftTopX();
                topY = playWnd.getLeftTopY();
            //    activePlayers = getPlayersWithCards(pdata, playWnd);
             //   sitoutPlayers = getSitoutPlayers(pdata, playWnd);
                emptyPlaces   = getEmptyPlace(pdata, playWnd);
             //   foldPlayers   = getFoldPlayers(pdata, playWnd);
               
View Full Code Here

Examples of com.poker.ui.windows.PlayWindow

        return true;
    }

    public Boolean updateWindowsFromWaitingList(final PokerData pdata) {

        PlayWindow playWnd;
        WindowPosition wpos;
        if (pdata.getWaitingWindowList().size() > 0) {
            playWnd = pdata.getWaitingWindowList().get(0);
            if (playWnd.getCurrentEvent() == EventType.ET_READY_FOR_GAME) {
                wpos = GetFirstFreeWinPosition(pdata);
                if (wpos == null) {
                    return false;
                }
                wpos.setPlayWindow(playWnd);
                playWnd.setCurrentPosition(wpos);
                movePlayWindow(pdata, wpos.getPlayWindow());
                pdata.getWaitingWindowList().remove(0);
            }
        }
        return true;
View Full Code Here

Examples of com.poker.ui.windows.PlayWindow

    public boolean killDeadTablesFromWaitingList(final PokerData pdata, final Integer[] handles) {

        Integer hWnd;
        boolean bWndInHandles;
        PlayWindow playWnd;
        final List<PlayWindow> waitinglist = pdata.getWaitingWindowList();
        final List<PlayWindow> listtmp = new ArrayList<PlayWindow>();
        for (int i = 0; i < waitinglist.size(); i++) {
            playWnd = waitinglist.get(i);

            hWnd = playWnd.gethWnd();
            bWndInHandles = false;
            if (handles == null) {
                bWndInHandles = false;
            } else {
                for (final Integer tmp : handles) {
                    if (tmp.equals(hWnd)) {
                        bWndInHandles = true;
                    }
                }

            }
            if (!bWndInHandles) {
                listtmp.add(playWnd);
                System.out.println(" The Window number " + playWnd.gethWnd()
                        + " was delete from waiting list");
            }
        }
        waitinglist.removeAll(listtmp);
View Full Code Here

Examples of com.poker.ui.windows.PlayWindow

    }

    public void RegWindowsToWaitingList(final PokerData pdata, final Integer[] handles) {

        WindowPosition wpos = null;
        PlayWindow playWnd;

        for (final Integer hWnd : handles) {
            if (!pdata.getMainWnd().IsMineHwnd(hWnd)) {
                wpos = FindPositionByHandle(pdata, hWnd);
                if (wpos == null) {
                    if (FindWindowInWaitingList(pdata, hWnd) == null) {
                        playWnd = RegWindowToWaitingList(pdata, hWnd);
                        playWnd.setCurrentEvent(EventType.ET_NEED_BUYIN);
                        playWnd.setLeftTop(getWindowPosByHandle(hWnd));
                        System.out.println("" + hWnd + " was regged to WaitingList");
                    }
                }
            }
        }
View Full Code Here

Examples of com.poker.ui.windows.PlayWindow

        return null;
    }

    public PlayWindow RegWindowToWaitingList(final PokerData pdata, final Integer handle) {

        PlayWindow playWnd;
        playWnd = new PlayWindow(handle, pdata.getProgramSettings().getCountPlayers());
        pdata.getWaitingWindowList().add(playWnd);
        return playWnd;
    }
View Full Code Here

Examples of com.poker.ui.windows.PlayWindow

    @Deprecated
    public WindowPosition RegWindowToPosition(final PokerData pdata, final Integer handle) {

        WindowPosition wpos = FindPositionByHandle(pdata, handle);
        PlayWindow playWnd;
        if (wpos == null) {
            wpos = GetFirstFreeWinPosition(pdata);
            if (wpos == null) {
                return null;
            }
            playWnd = new PlayWindow(handle, pdata.getProgramSettings().getCountPlayers());

            wpos.setPlayWindow(playWnd);
            playWnd.setCurrentPosition(wpos);
        }
        return wpos;
    }
View Full Code Here

Examples of com.poker.ui.windows.PlayWindow

    return false;
  }

  public void analyzeOneTableFromWaitingList(final PokerData pdata, final PokerControl pControl) {

    PlayWindow playWnd;
    String buyIn;

    while (pdata.getWaitingWindowList().size() != 0) {
      playWnd = pdata.getWaitingWindowList().get(0);
      if (playWnd.getCurrentEvent() == EventType.ET_READY_FOR_GAME) {
        break;
      }
      pControl.activateWindow(playWnd);
      try {
        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.ui.windows.PlayWindow

    public void Run() throws InterruptedException , IOException{

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

Examples of com.poker.ui.windows.PlayWindow

public class PlayWindowFactory {
 
 
  public static PlayWindow getPlayWindow() throws Exception{
   
    PlayWindow playWnd = new PlayWindow(0, 10);   
    PokerControl pControl = new PokerControl();
    PokerData pdata = new PokerData();
    playWnd.setCurrentEvent(EventType.ET_IN_GAME);
    return playWnd;
  }/*
 
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.