Package com.barrybecker4.common.geometry

Examples of com.barrybecker4.common.geometry.ByteLocation


     */
    private boolean allEmptiesVisited(Set<Location> visited) {
        Box bbox = tantrix.getBoundingBox();
        for (int i = bbox.getMinRow(); i < bbox.getMaxRow(); i++) {
            for (int j = bbox.getMinCol(); j <= bbox.getMaxCol(); j++)  {
                Location loc = new ByteLocation(i, j);
                if (tantrix.get(loc) == null && !visited.contains(loc))  {
                    return false;
                }
            }
        }
View Full Code Here


     * factory method for getting new moves. It uses recycled objects if possible.
     * @return the newly created move.
     */
    public static TwoPlayerMove createMove( int destinationRow, int destinationCol,
                                            int val, GamePiece piece ) {
        return new TwoPlayerMove(new ByteLocation(destinationRow, destinationCol), val, piece);
    }
View Full Code Here

        for (int i=1; i<=nrows; i++) {
            for (int j=1; j<=ncols; j++) {
                BoardPosition pos = board.getPosition(i, j);
                if (pos.isOccupied()) {
                    applyPositionToKey(new ByteLocation(i, j), board.getStateIndex(pos));
                }
            }
        }
        return currentKey;
    }
View Full Code Here

         boolean pawnBlockingPath =
                 (dirDirPosition!=null && dirDirPosition.getPiece()!=null );
         if (directionOpen && !dirPosition.isVisited() &&
                  (pawnBlockingPath || dirPosition.isHomeBase(opponentPlayer1))) {
              possibleMoveList.add(
                      BlockadeMove.createMove(new ByteLocation(fromRow, fromCol),
                              new ByteLocation(fromRow + rowOffset, fromCol + colOffset),
                              0, position.getPiece(), null));
               GameContext.log(2, "ADDED 1 HOP" + dirPosition);
          }
     }
View Full Code Here

        float increment = (float)numCols/(NUM_HOMES+1);
        int baseOffset = Math.round(increment);
        for (int i=0; i<NUM_HOMES; i++) {
            int c = baseOffset + Math.round(i*increment);

            p1Homes_[i] = new BlockadeBoardPosition(new ByteLocation(homeRow1, c), null, null, null, true, false);
            p1Homes_[i].setPiece(new GamePiece(true));
            p2Homes_[i] = new BlockadeBoardPosition(new ByteLocation(homeRow2, c), null, null, null, false, true);
            p2Homes_[i].setPiece(new GamePiece(false));
        }
    }
View Full Code Here

         BlockadeWall wall = null;
         if (mvToken.hasWall())
             wall = new BlockadeWall(new BlockadeBoardPosition(mvToken.getWallPoint1().y, mvToken.getWallPoint1().x),
                                                       new BlockadeBoardPosition(mvToken.getWallPoint2().y, mvToken.getWallPoint2().x));

         return BlockadeMove.createMove(new ByteLocation(mvToken.getFromY(), mvToken.getFromX()),
                 new ByteLocation(mvToken.getToY(), mvToken.getToX()),
                 0, new GamePiece(player1), wall);
    }
View Full Code Here

     * Simple version of the above constructor for when we just want a generic position based on the row and column.
     * @param row location.
     * @param col location.
     */
    public BlockadeBoardPosition( int row, int col) {
        this( new ByteLocation(row, col), null, null, null, false, false);
    }
View Full Code Here

        List<Location> list = new LinkedList<Location>();
        for (byte i = 0; i<SIZE; i++) {
            for (byte j = 0; j<SIZE; j++) {
                if (isValidPosition(i, j) && getPosition(i, j) == pegged) {
                    list.add(new ByteLocation(i, j));
                }
            }
        }
        return list;
    }
View Full Code Here

     * All we need to know is the from position (which can be stored in 6 bits) and the to direction (which can be stored in 2 bits)
     * I know that a jump is always 2 spaces.
     */
    PegMove(byte fromRow, byte fromCol,
            byte destinationRow, byte destinationCol) {
        fromPosition = new ByteLocation(fromRow, fromCol);
        toPosition = new ByteLocation(destinationRow, destinationCol);
    }
View Full Code Here

        Point point = argument.m_point;

        if (point != null)  {
            boolean isBlack = controller_.getCurrentPlayer().equals(controller_.getPlayers().getPlayer1());
            GoMove move = new GoMove(new ByteLocation(point.getX()+1, point.getY()+1)0, new GoStone(isBlack));
            controller_.manMoves(move);
        }
        return true;
    }
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.