Package com.barrybecker4.common.geometry

Examples of com.barrybecker4.common.geometry.Location


        southPos = position.getNeighbor(Direction.SOUTH, board);
    }

    private boolean checkSouthOptions(boolean eastOpen, boolean southOpen) {
        if (southPos != null ) {
             Location toLocation = fromLocation.incrementOnCopy(2, 0);
             addIf2HopLegal(southOpen, southPos.isSouthBlocked(), toLocation);                  // SS

             BlockadeBoardPosition southEastPos = position.getNeighbor(Direction.SOUTH_EAST, board);
             addIfDiagonalLegal(southEastPos, eastOpen && !eastPos.isSouthBlocked(),
                                southOpen && !southPos.isEastBlocked());                        // SE
View Full Code Here


    }

    private void checkWest(boolean westOpen) {
        BlockadeBoardPosition westWestPos = position.getNeighbor(Direction.WEST_WEST, board);
        if (westWestPos != null) {
           Location toLocation = fromLocation.incrementOnCopy(0, -2);
           addIf2HopLegal(westOpen, westWestPos.isEastBlocked(), toLocation);                    // WW
        }
    }
View Full Code Here

                                northOpen && !northPos.isEastBlocked());                          // NE
        }

        BlockadeBoardPosition northNorthPos = position.getNeighbor(Direction.NORTH_NORTH, board);
        if (northNorthPos != null) {
            Location toLocation = fromLocation.incrementOnCopy(-2, 0);
            addIf2HopLegal(northOpen, northNorthPos.isSouthBlocked(), toLocation);                 // NN
        }

        BlockadeBoardPosition northWestPos = position.getNeighbor(Direction.NORTH_WEST, board);
        if (northWestPos != null) {
View Full Code Here

        }
    }

    private void checkEast(boolean eastOpen) {
        if (eastPos != null) {
            Location toLocation = fromLocation.incrementOnCopy(0, 2);
            addIf2HopLegal(eastOpen, eastPos.isEastBlocked(), toLocation);                       // EE
        }
    }
View Full Code Here

    /**
     * @return the tooltip for the panel given a mouse event.
     */
    @Override
    public String getToolTipText( MouseEvent e ) {
        Location loc = getBoardRenderer().createLocation(e);
        StringBuilder sb = new StringBuilder( "<html><font=-3>" );

        BlockadeBoardPosition space = ((BlockadeBoard)controller_.getBoard()).getPosition( loc );
        if ( space != null && GameContext.getDebugMode() > 0 ) {
            sb.append(space.toString());
View Full Code Here

        BlockadeBoardViewer viewer = (BlockadeBoardViewer) viewer_;
        if (viewer.get2PlayerController().isProcessing() || wallPlacingMode)
            return;

        Board board = viewer.getBoard();
        Location loc = getRenderer().createLocation(e);
        BoardPosition position = board.getPosition( loc );

        // if there is no piece, or out of bounds, then return without doing anything
        if ( (position == null) || (position.isUnoccupied()) ) {
            return;
View Full Code Here

    @Override
    public void mouseReleased( MouseEvent event )
    {
        // compute the coordinates of the position that we dropped the piece on.
        BlockadeBoardViewer viewer = (BlockadeBoardViewer) viewer_;
        Location loc = getRenderer().createLocation(event);

        if (!wallPlacingMode)  {
            boolean placed = placePiece( loc );
            if (!placed) {
                getRenderer().setDraggedPiece(null);
View Full Code Here

     */
    @Override
    public void mouseDragged( MouseEvent e )
    {
        GameBoardRenderer renderer = getRenderer();
        Location loc = renderer.createLocation(e);

        if ( renderer.getDraggedShowPiece() != null ) {
            renderer.getDraggedShowPiece().setLocation( loc );
        }
        viewer_.repaint();
View Full Code Here

        if (wallPlacingMode)  {

            // show the hovering wall
            BlockadeBoard board = (BlockadeBoard)viewer.getBoard();
            // now show it in the new location
            Location loc = getRenderer().createLocation(e);
            if (board.getPosition(loc)==null) {
                return// out of bounds
            }

            BlockadeBoardPosition[] positions =
View Full Code Here

    }

    public BlockadeBoardPosition getNeighbor(Direction d, BlockadeBoard board) {
        int row = getRow();
        int col = getCol();
        Location offset = d.getOffset();
        return board.getPosition(row + offset.getRow(), col + offset.getCol());
    }
View Full Code Here

TOP

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

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.