Package com.poker.control

Examples of com.poker.control.PokerControl


  public static String bPathR =
    "src/com/poker/test/buffer.r";
 
 
  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


  /**
   * @param args
   */
  public static void main(String[] args) throws Exception{
    PokerControl pControl = new PokerControl();
    PokerData pData = new PokerData();
   
   
    //BufferedImage[] hStacks = pControl.getStacksImages(pdata, playWnd);
   
   
    BufferedImage pict = ImageIO.read(new File("c:\\temp\\euro1.bmp"));
   
   
    Table table = pData.getRoomSettings().getTableSettings(10);
    BufferedImage[] hStacks = new BufferedImage[10];
    Rectangle rect;
    for (int i = 0; i<10; i++){
      rect = table.getRectPlayerStack(i);
      hStacks[i] = pict.getSubimage(rect.x, rect.y, rect.width, rect.height);
     
     
    }
       
        hStacks = pControl.getPreparedStacksImages(pData, hStacks, 2);
        String[] strStacks = pControl.getStacksStrings(pData, hStacks);
        Float[] flStacks = pControl.getStacksFloats(pData, strStacks);
       
       
       
       
        for (int i=0; i<flStacks.length; i++){
View Full Code Here

    return board;
  }

  public static PlayWindow fillPlayWindow(PlayWindow playWnd, String strBuffer) throws Exception{

    PokerControl pControl = new PokerControl();
    PokerData pdata = new PokerData();
    final BufferParser bufferParser = pdata.getRoomSettings().getBufferParser("");

    // Opening buffer
    File file = new File(strBuffer);
    FileReader fr = new FileReader(file);
    char[] buffer = new char[10000];   
    fr.read(buffer);   
    strBuffer = new String(buffer);
    strBuffer = strBuffer.trim();
    //System.out.println(strBuffer);


    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));                      
    board = pControl.setParserResultsToBoard(pdata, pControl, board, parserResult);




    switch(parserResult.getCurrentRound()){
View Full Code Here

    long gbTimeCounterDelay   = 10*1000;
   

    public PokerMain() {
        this.pData = new PokerData();
        this.pControl = new PokerControl();
      //  this.owThread = new OpenWindowThread(this.pData, this.pControl);
      //  this.pwThread = new PrepareWindowThread(this.pData, this.pControl);
        this.pData.getProgramSettings().setDelayMainThreadMs(300);
        this.pData.getProgramSettings().setDelayOpenThreadMs(5000);
        this.pData.getProgramSettings().setDelayPrepareThreadMs(500);
View Full Code Here

 
 
  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

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

TOP

Related Classes of com.poker.control.PokerControl

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.