Examples of Board


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;
  }

Examples of com.poker.analyst.element.Board

      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;
  }

Examples of com.poker.analyst.element.Board

    }

    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;

Examples of com.poker.analyst.element.Board

   
    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");

Examples of com.poker.analyst.element.Board

  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)){         

Examples of com.poker.analyst.element.Board


    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));                      

Examples of com.poker.analyst.element.Board

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

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

Examples of com.threerings.puzzle.data.Board

        int size = gevents.length;
        boolean before = compareBeforeApply();

        for (int ii = 0; ii < size; ii++) {
            int gevent = gevents[ii];
            Board cboard = (states == null) ? null : states[ii];

            // if we have state syncing enabled, make sure the board is correct before applying the
            // event
            if (before && (cboard != null)) {
                compareBoards(pidx, cboard, gevent, before);

Examples of com.tinygo.logic.Board

        }
    }

    public void testNavigation() {
        DocumentedGame game = new DocumentedGame(4);
        Board board = game.board;
        try {
            assertFalse(game.prev());
            assertFalse(game.next());

            SGFNode n2w, n3b_1, n3b_2;
            // test forward/backward navigation
            game.play(3, 3, Board.BLACK);
            game.play(0, 1, Board.WHITE);
            n2w = game.kifuLastMove();
            game.play(0, 2, Board.BLACK);
            n3b_1 = game.kifuLastMove();

            assertTrue(game.prev());
            assertSame(n2w, game.kifuLastMove());
            assertEquals(board.pos(0, 1), game.lastMove);
            assertEquals(Board.BLACK, game.colorToPlay);
            assertTrue(game.next());
            assertSame(n3b_1, game.kifuLastMove());
            assertEquals(board.pos(0, 2), game.lastMove);
            assertEquals(Board.WHITE, game.colorToPlay);
            assertFalse(game.next());

            // test variant navigation
            assertTrue(game.prev());
            game.play(0, 0, Board.BLACK); // variant to 0,2
            n3b_2 = game.kifuLastMove();
            assertEquals(board.pos(0, 0), game.lastMove);
            assertFalse(game.nextVariant());
            assertTrue(game.prevVariant());
            assertSame(n3b_1, game.kifuLastMove());
            assertEquals(board.pos(0, 2), game.lastMove);
            assertFalse(game.prevVariant());
            assertTrue(game.nextVariant());
            assertSame(n3b_2, game.kifuLastMove());
            assertEquals(board.pos(0, 0), game.lastMove);

            assertEquals(Board.WHITE, game.colorToPlay);

            // check if variant option is remembered
            assertFalse(game.nextVariant());

Examples of driftingdroids.model.Board

    private static void runTestRandom1000() throws InterruptedException {
        final Date startDate = new Date();
       
        final int numGames = 1000;
       
        final Board theBoard = Board.createBoardGameID("0765+42+2E21BD0F+93");
       
        int maxMoves = -1;
        String maxSolution = "";
        for (int i = 1; i <= numGames; ++i) {
           
            theBoard.setRobotsRandom();
            final Solver theSolver = Solver.createInstance(theBoard);
            final Solution theSolution = theSolver.execute().get(0);
            final int moves = theSolution.size();
           
            //System.err.println(i + " usedMem=" + (getBytesUsed() >> 20) + " MiB  " + theSolver.getKnownStatesNumber());
           
            if ((0 == i % 100) || (moves > maxMoves)) {
                String msg = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
                msg += "  gamesSolved=" + i + "/" + numGames + "  maxMoves=" + (moves > maxMoves ? moves : maxMoves);
                System.out.println(msg);
            }
            if (moves > maxMoves) {
                maxMoves = moves;
                maxSolution = theBoard.toString() + "\n" + theSolver.toString() + '\n';
                System.out.println(maxSolution);
            } else {
                System.out.println("\n***** run #" + i + "  -  current maxMoves still is " + maxMoves + " *****\n");
            }
        }
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.