Package com.barrybecker4.game.common.board

Examples of com.barrybecker4.game.common.board.Board


     * return the game to its original state.
     */
    @Override
    public void reset() {
        controller_.reset()//clear what's there and start over
        Board board = (Board) controller_.getBoard();
        commonReset(board);
    }
View Full Code Here


        if (controller.isProcessing())
            return;
        Location loc = getRenderer().createLocation(e);

        Board board = (Board)controller.getBoard();
        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;
        }
        GamePiece piece = position.getPiece();
View Full Code Here

        Location loc = getRenderer().createLocation(e);

        if ( getRenderer().getDraggedPiece() == null )
            return; // nothing being dragged

        Board board = (Board)controller.getBoard();
        // get the original position.
        BoardPosition position = board.getPosition( getRenderer().getDraggedPiece().getLocation());

        // valid or not, we won't show the dragged piece after releasing the mouse
        getRenderer().setDraggedPiece(null);

        BoardPosition destp = board.getPosition( loc );
        if (customCheckFails(position, destp)) {
            invalidMove();
            return;
        }
View Full Code Here

     * return the game to its original state.
     */
    @Override
    public void reset() {
        controller_.reset()//clear what's there and start over
        Board board = getBoard();
        commonReset(board);
    }
View Full Code Here

        mainController_ = (TwoPlayerController)gce.getController();
        motionListener_.setMainController(mainController_);
        gameTreeButtons_.setMainController(mainController_);
        // it is possible that the size of the game has changed since the game tree controller
        // was initialized. Make sure that it is synched up.
        Board mainBoard = (Board)mainController_.getBoard();
        Board board = (Board)controller_.getBoard();
        if ( mainBoard.getNumRows() != board.getNumRows() || mainBoard.getNumCols() != board.getNumCols() ) {
            board.setSize( mainBoard.getNumRows(), mainBoard.getNumCols() );
        }

        // can't do it if we are in the middle of searching
        if (mainController_.isProcessing())  {
            return;
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

     * if none of the generated moves have an inherited value better than the passing move
     * (which just uses the value of the current move) then we should pass.
     */
    private void addPassingMoveIfNeeded(TwoPlayerMove lastMove, MoveList moveList) {

        Board b = searchable_.getBoard();
        if (searchable_.getNumMoves() > (b.getNumCols() + b.getNumRows()))  {
            GoMove passMove = GoMove.createPassMove(lastMove.getValue(), !lastMove.isPlayer1());
            moveList.add(moveList.size(), passMove);
        }
    }
View Full Code Here

     * the first move of the game (made by the computer)
     */
    @Override
    public void computerMovesFirst() {
        int delta = getWinRunLength() - 1;
        Board b = (Board) getBoard();
        int c = (int) (GameContext.random().nextFloat() * (b.getNumCols() - 2 * delta) + delta + 1);
        int r = (int) (GameContext.random().nextFloat() * (b.getNumRows() - 2 * delta) + delta + 1);
        TwoPlayerMove m = TwoPlayerMove.createMove( r, c, 0, new GamePiece(true) );
        makeMove( m );
    }
View Full Code Here

            throw new RuntimeException(e);
        }

        try {
            // initial update to the game tables for someone entering the room.
            GameCommand cmd = new GameCommand(GameCommand.Name.UPDATE_TABLES, cmdProcessor.getTables());
            update(cmd);

            while (!stopped) {
                // receive the serialized commands that are sent and process them.
                cmd = (GameCommand) iStream.readObject();
View Full Code Here

            default:
                assert false : "Unhandled command: "+ cmd;
        }

        if (useUpdateTable) {
            GameCommand response = new GameCommand(GameCommand.Name.UPDATE_TABLES, getTables());
            responses.add(0, response)// add as first command in response.
        }

        return responses;
    }
View Full Code Here

TOP

Related Classes of com.barrybecker4.game.common.board.Board

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.