Package com.barrybecker4.game.twoplayer.go

Examples of com.barrybecker4.game.twoplayer.go.GoController$BoardOptions


    }

    @Override
    protected NewGameDialog createNewGameDialog(Component parent, GameViewModel viewer )
    {
        return new GalacticNewGameDialog( parent, viewer );
    }
View Full Code Here


    }

    @Override
    protected GameOptionsDialog createOptionsDialog(Component parent, GameController controller )
    {
        return new GalacticOptionsDialog( parent, controller );
    }
View Full Code Here

     * display a dialog at the end of the game showing who won and other relevant
     * game specific information.
     */
    @Override
    public void showWinnerDialog() {
        GalacticTallyDialog tallyDialog = new GalacticTallyDialog(parent_, (GalacticController)controller_);
        tallyDialog.showDialog();
    }
View Full Code Here

     */
    private void showOrdersDialog(GalacticController gc) {

        GalacticPlayer currentPlayer = (GalacticPlayer)gc.getCurrentPlayer();

        OrdersDialog ordersDialog =
                new OrdersDialog(null, currentPlayer, gc.getNumberOfYearsRemaining());
        Point p = getParent().getLocationOnScreen();

        // offset the dlg so the Galaxy grid is visible as a reference
        ordersDialog.setLocation((int)(p.getX()+0.7*getParent().getWidth()), (int)(p.getY()+getParent().getHeight()/3.0));

        boolean canceled = ordersDialog.showDialog();
        if ( !canceled ) { // newGame a game with the newly defined options
            currentPlayer.setOrders( ordersDialog.getOrders() );
            gc.advanceToNextPlayer();
        }
    }
View Full Code Here

        }
        return status;
    }

    private void initSize(int size) {
        controller_ = new GoController(size, 0);
        SearchOptions options =
            ( (TwoPlayerPlayerOptions)controller_.getCurrentPlayer().getOptions() ).getSearchOptions();

        options.getBruteSearchOptions().setAlphaBeta(true);
        options.getBruteSearchOptions().setLookAhead(2);
View Full Code Here

        getBoardRenderer().setDraggedShowPiece(null);
    }

    @Override
    protected GameController createController()  {
        return new GoController();
    }
View Full Code Here

     * Constructor.
     */
    public GoViewerMouseListener(GameBoardViewer viewer) {
        super(viewer);

        GoController controller = (GoController) viewer.getController();
        if (!controller.getPlayers().allPlayersComputer()) {
            getRenderer().setDraggedShowPiece(
                    new GoBoardPosition(0, 0, null, new GoStone(controller.isPlayer1sTurn())));
            savedShowPiece_ = getRenderer().getDraggedShowPiece();
        }
    }
View Full Code Here

     *  mouseClicked requires both the mouse down and mouse up event to occur at the same location.
     */
    @Override
    public void mousePressed( MouseEvent e ) {

        GoController controller = (GoController) viewer_.getController();
        // all derived classes must check this to disable user clicks while the computer is thinking
        if (controller.isProcessing()) {
            return;
        }
        Location loc = getRenderer().createLocation(e);
        GoBoard board = (GoBoard) controller.getBoard();
        boolean player1sTurn = controller.isPlayer1sTurn();

        GameContext.log( 3, "BoardViewer: mousePressed: player1sTurn()=" + player1sTurn);

        GoMove m = new GoMove( loc, 0, new GoStone(player1sTurn));

View Full Code Here

    /**
     * Place the stone on the board.
     */
    private void processStonePlacement(Location loc, GoMove m, GoBoardPosition stone) {

        GoController controller = (GoController) viewer_.getController();
        GoBoard board = (GoBoard) controller.getBoard();
        boolean player1sTurn = controller.isPlayer1sTurn();

        if ( stone.isOccupied() ) {
            JOptionPane.showMessageDialog( null, GameContext.getLabel("CANT_PLAY_ON_STONE") );
            GameContext.log( 0, "BoardViewer: There is already a stone there: " + stone );
            return;
        }
        if ( GoMoveGenerator.isTakeBack(m.getToRow(), m.getToCol(), (GoMove) controller.getLastMove(), board) ) {
            JOptionPane.showMessageDialog( null, GameContext.getLabel("NO_TAKEBACKS"));
            return;
        }
        assert(!stone.isVisited());

        if (m.isSuicidal(board)) {
            JOptionPane.showMessageDialog( null, GameContext.getLabel("SUICIDAL") );
            GameContext.log( 1, "BoardViewer: That move is suicidal (and hence illegal): " + stone );
            return;
        }

        if ( !((AbstractTwoPlayerBoardViewer)viewer_).continuePlay( m ) ) {   // then game over
            getRenderer().setDraggedShowPiece(null);
        }
        else if (controller.getPlayers().allPlayersHuman()) {
            // create a stone to show for the next players move
            getRenderer().setDraggedShowPiece(
                    new GoBoardPosition(loc.getRow(), loc.getCol(), null, new GoStone(!player1sTurn)));
        }
    }
View Full Code Here

     * When the player clicks the wall is irrevocably placed.
     */
    @Override
    public void mouseMoved( MouseEvent e )
    {
        GoController controller = (GoController) viewer_.getController();
        if (controller.isProcessing()) {
            return;
        }
        Location loc = getRenderer().createLocation(e);

        if ( getRenderer().getDraggedShowPiece() != null ) {
View Full Code Here

TOP

Related Classes of com.barrybecker4.game.twoplayer.go.GoController$BoardOptions

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.