Package com.barrybecker4.common.geometry

Examples of com.barrybecker4.common.geometry.ByteLocation


    /**
     * factory method for creating a passing move
     * @return new passing move
     */
    public static GoMove createPassMove(int val, boolean player1) {
        GoMove m = new GoMove(new ByteLocation(1, 1), val, null );
        m.isPass_ = true;
        m.setPlayer1(player1);
        return m;
    }
View Full Code Here


    /**
     * factory method for creating a resignation move
     * @return new resignation move
     */
    public static GoMove createResignationMove(boolean player1) {
        GoMove m = new GoMove( new ByteLocation(1, 1), 0, null );
        m.isResignation_ = true;
        m.setPlayer1(player1);
        return m;
    }
View Full Code Here

        for (int i = 1; i <= nCols; i++ )  {
            for (int j = 1; j <= nRows; j++ )  {
                // if its a candidate move and not an immediate take-back (which would break the rule of ko)
                if ( candidateMoves.isCandidateMove( j, i ) && !isTakeBack( j, i, (GoMove) lastMove, board ) ) {
                    GoMove m = new GoMove( new ByteLocation(j, i), lastMoveValue, new GoStone(player1) );

                    if ( m.isSuicidal(board) ) {
                        GameContext.log(3, "The move was a suicide (can't add it to the list): " + m);
                    }
                    else {
View Full Code Here

        boolean player1 = token instanceof AddBlackToken;

        while (points.hasNext()) {
            Point point = points.next();
            //System.out.println("adding move at row=" + point.y+" col="+ point.x);
            moveList.add( new GoMove( new ByteLocation(point.y, point.x), 0, new GoStone(player1)));
        }
    }
View Full Code Here

          MoveToken mvToken = (MoveToken) token;
          if (mvToken.isPass()) {
              return GoMove.createPassMove(0, !mvToken.isWhite());
          }
          return new GoMove(
                  new ByteLocation(mvToken.getY(), mvToken.getX()),
                  0, new GoStone(!mvToken.isWhite()));
    }
View Full Code Here

        float totalPotential = 0;
        RunPotentialAnalyzer runAnalyzer = new RunPotentialAnalyzer(groupString, board_, analyzerMap_);

        for ( int r = rMin; r <= rMax; r++ ) {
            totalPotential += runAnalyzer.getRunPotential(new ByteLocation(r, cMin), 0, 1, rMax, cMax);
        }
        return totalPotential;
    }
View Full Code Here

        float totalPotential = 0;
        RunPotentialAnalyzer runAnalyzer = new RunPotentialAnalyzer(groupString, board_, analyzerMap_);

        for ( int c = cMin; c <= cMax; c++ ) {
            totalPotential += runAnalyzer.getRunPotential(new ByteLocation(rMin, c), 1, 0, rMax, cMax);
        }
        return totalPotential;
    }
View Full Code Here

     * The pot will be drawn in the middle of the table.
     */
    @Override
    protected void drawMarkers(Board board, PlayerList players, Graphics2D g2  ) {

        Location loc = new ByteLocation(board.getNumRows() >> 1, (board.getNumCols() >> 1) - 3);
        int pot = ((PokerTable)board).getPotValue();
        new ChipRenderer().render(g2, loc, pot, this.getCellSize());

        // now draw the players and their stuff (face, name, chips, cards, etc)
        super.drawMarkers(board, players, g2);
View Full Code Here

        this.setPreferredSize(new Dimension(400, 120));
    }

    @Override
    protected void paintComponent(Graphics g) {
         handRenderer.render((Graphics2D) g, new ByteLocation(0, 2), hand_, 22);
    }
View Full Code Here

    public void render(Graphics2D g2, TilePlacement tilePlacement,
                       Location topLeftCorner, double radius) {

        if (tilePlacement == null) return;
        boolean isOddRow = tilePlacement.getLocation().getRow() % 2 == 1;
        Location location =
            tilePlacement.getLocation().decrementOnCopy(topLeftCorner);

        double x = radius/2
                + ((location.getCol() - (isOddRow ? -0.25:  -0.75)) * 2 * radius * HexUtil.ROOT3D2);
        double y = radius/+ TOP_MARGIN
                + ((location.getRow() + 0.6) * 3.0 * radius / 2.0);

        Point point = new Point((int)x, (int)y);
        drawHexagon(g2, point, radius);
        pathRenderer.drawPath(g2, 0, tilePlacement, point, radius);
        pathRenderer.drawPath(g2, 1, tilePlacement, point, radius);
View Full Code Here

TOP

Related Classes of com.barrybecker4.common.geometry.ByteLocation

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.