Package com.barrybecker4.common.geometry

Examples of com.barrybecker4.common.geometry.ByteLocation


    }

    @Override
    protected Player createPlayer() {
        int ct = table_.getRowCount();
        Planet planet = new Planet((char)('A'+ct), GalacticPlayer.DEFAULT_NUM_SHIPS, 10, new ByteLocation(0,0));
        Color newColor = MultiGamePlayer.getNewPlayerColor(getPlayers());
        GalacticPlayer player = GalacticPlayer.createGalacticPlayer(
                                             "Admiral "+(ct+1), planet, newColor, true);
        planet.setOwner(player);
        return player;
View Full Code Here


     * @param row - y position on the board.
     * @param col - x position on the board.
     * @param piece - the piece to put at this position (use null if there is none).
     */
    public BoardPosition( int row, int col, GamePiece piece)  {
        this(new ByteLocation(row, col), piece);
    }
View Full Code Here

        this(new ByteLocation(row, col), piece);
    }

    public BoardPosition(BoardPosition p) {

        location_ = new ByteLocation(p.getRow(), p.getCol());
        if (p.piece_ != null)
            piece_ = p.piece_.copy();
        else
            piece_ = null;
    }
View Full Code Here

    }

    public void clear(BoardPosition proto) {
        for ( int i = 1; i <= getNumRows(); i++ ) {
            for ( int j = 1; j <= getNumCols(); j++ ) {
                proto.setLocation(new ByteLocation(i, j));
                positions_[i][j] = proto.copy();
            }
        }
    }
View Full Code Here

        if ( opponentAdjacent
              && beyondNext!=null && beyondNext.isUnoccupied()
              && (m.captureList != null) && (!m.captureList.alreadyCaptured( next )) ) {
            // then there is another jump. We must take it.
            CheckersMove mm = m.copy()// base it on the original jump
            mm.setToLocation(new ByteLocation(beyondNext.getLocation().getRow(), beyondNext.getLocation().getCol()));
            mm.captureList.add( next.copy() );
            // next.setPiece(null); ?

            boolean justKinged = false;   // ?? may be superfluous
            GameContext.log( 2, "calling findJumpMoves on " +
View Full Code Here

        // After that, they can change manually to get different players.
        if (getPlayers() == null) {
            // create the default players. One human and one robot.
            PlayerList players = new PlayerList();

            Planet homePlanet = new Planet('A', GalacticPlayer.DEFAULT_NUM_SHIPS, 10, new ByteLocation(5, 5));
            players.add(GalacticPlayer.createGalacticPlayer("Admiral 1",
                                      homePlanet, MultiGamePlayer.getNewPlayerColor(players), true));
            homePlanet.setOwner((GalacticPlayer)players.get(0));

            homePlanet = new Planet('B', GalacticPlayer.DEFAULT_NUM_SHIPS, 10, new ByteLocation(10, 10));
            players.add(GalacticPlayer.createGalacticPlayer("Admiral 2",
                                      homePlanet, MultiGamePlayer.getNewPlayerColor(players), false));
            homePlanet.setOwner((GalacticPlayer)players.get(1));
            setPlayers(players);
        }
View Full Code Here

    public UserEnteredValues() {
    }

    public UserValue get(int row, int col)  {
        return get(new ByteLocation(row, col));
    }
View Full Code Here

    public Location getCellCoordinates(Point point) {

        int row = (int)((point.getY() - MARGIN) / pieceSize);
        int col = (int)((point.getX() - MARGIN) / pieceSize);
        return new ByteLocation(row, col);
    }
View Full Code Here

    /**
     * @return the placement at the specified location.
     */
    public TilePlacement getTilePlacement(int row, int col) {
        return get(new ByteLocation(row, col));
    }
View Full Code Here

        Box bbox = tantrix.getBoundingBox();
        Set<Location> empties = new HashSet<Location>();

        for (int i = bbox.getMinCol(); i <= bbox.getMaxCol(); i++) {
            Location loc = new ByteLocation(bbox.getMinRow(), i);
            if (tantrix.get(loc) == null)  {
                empties.add(loc);
            }
            loc = new ByteLocation(bbox.getMaxRow(), i);
            if (tantrix.get(loc) == null)  {
                empties.add(loc);
            }
        }

        for (int i = bbox.getMinRow() + 1; i < bbox.getMaxRow(); i++) {
            Location loc = new ByteLocation(i, bbox.getMinCol());
            if (tantrix.get(loc) == null)  {
                empties.add(loc);
            }
            loc = new ByteLocation(i, bbox.getMaxCol());
            if (tantrix.get(loc) == null)  {
                empties.add(loc);
            }
        }
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.