Package com.barrybecker4.ui.components

Examples of com.barrybecker4.ui.components.NumberInput


        boolean perfectLoop = false;
        double compactness = determineCompactness(path);

        if (consistentLoop) {
            Tantrix tantrix = new Tantrix(path.getTilePlacements());
            InnerSpaceDetector innerDetector = new InnerSpaceDetector(tantrix);
            perfectLoop = !innerDetector.hasInnerSpaces();
            //System.out.println("perfect loop");
        }

        double fitness =
                LOOP_PROXIMITY_WEIGHT * (numTiles - distance) / (0.1 + numTiles)
View Full Code Here


                               boolean useConcurrency) {
        super(board);
        puzzlePanel_ = puzzlePanel;
        strategy = useConcurrency ? OptimizationStrategyType.CONCURRENT_GENETIC_SEARCH :
                                    OptimizationStrategyType.GENETIC_SEARCH;
        evaluator = new PathEvaluator();
    }
View Full Code Here

     * @return list of moves to a solution.
     */
    @Override
    public TilePlacementList solve()  {

        ParameterArray initialGuess = new TantrixPath(board);
        assert(initialGuess.size() > 0) : "The random path should have some tiles!";
        long startTime = System.currentTimeMillis();

        Optimizer optimizer = new Optimizer(this);
        optimizer.setListener(this);

View Full Code Here

     * We show the current status.
     * @param params
     */
    public void optimizerChanged(ParameterArray params) {
        // update our current best guess at the solution.
        TantrixPath path = (TantrixPath)params;
        solution_ = new TantrixBoard(path.getTilePlacements(), path.getPrimaryPathColor());
        puzzlePanel_.refresh(solution_, numTries_++);
    }
View Full Code Here

    /**
     * Constructor.
     */
    public TantrixViewer() {
        renderer_ = new TantrixBoardRenderer();
    }
View Full Code Here

        boardColorButton_ = new JButton("...");
        GameBoardViewer v = ((GameBoardViewer)controller_.getViewer());
        boardColorButton_.setBackground(v.getBackground());
        gridColorButton_ = new JButton("...");
        gridColorButton_.setBackground(v.getGridColor());
        JPanel boardColorPanel = new ColorInputPanel(GameContext.getLabel("SELECT_BOARD_COLOR"),
                                                     GameContext.getLabel("SELECT_BOARD_COLOR_TIP"),
                                                     boardColorButton_);
        JPanel gridColorPanel = new ColorInputPanel(GameContext.getLabel("SELECT_GRID_COLOR"),
                                                    GameContext.getLabel("SELECT_GRID_COLOR_TIP"),
                                                    gridColorButton_);
        p.add( boardColorPanel );
        p.add( gridColorPanel );
        JPanel spacer = new JPanel();
View Full Code Here

    /** create the OK Cancel buttons that go at the bottom */
    @Override
    protected JPanel createButtonsPanel() {
        JPanel buttonsPanel = new JPanel( new FlowLayout() );

        okButton_ =  new GradientButton();
        initBottomButton( okButton_, GameContext.getLabel("OK"), GameContext.getLabel("USE_OPTIONS") );
        initBottomButton(cancelButton, GameContext.getLabel("CANCEL"), GameContext.getLabel("RESUME") );

        buttonsPanel.add( okButton_ );
        buttonsPanel.add(cancelButton);
View Full Code Here

    @Override
    protected JPanel createButtonsPanel() {
        JPanel buttonsPanel = new JPanel( new FlowLayout() );

        startButton_ = new GradientButton();
        initBottomButton( startButton_, GameContext.getLabel("START_GAME"), GameContext.getLabel("START_GAME_TIP") );
        initBottomButton(cancelButton, GameContext.getLabel("CANCEL"), GameContext.getLabel("NGD_CANCEL_TIP") );

        buttonsPanel.add( startButton_ );
        buttonsPanel.add(cancelButton);
View Full Code Here

        //setCommandPanelTitle(Player player)

        JPanel bp = createPanel();
        bp.setBorder(createMarginBorder());

        commandButton_ = new GradientButton(GameContext.getLabel("ORDERS"));
        commandButton_.addActionListener(this);
        bp.add(commandButton_);

        passButton_ = new GradientButton(GameContext.getLabel("PASS"));
        passButton_.addActionListener(this);
        bp.add(passButton_);

        commandPanel_.add(bp);
        return commandPanel_;
View Full Code Here

        return p;
    }

    protected void addDebugLevel(JPanel p) {
        dbgLevelField_ =
                new NumberInput( GameContext.getLabel("DEBUG_LEVEL"), GameContext.getDebugMode(),
                                 GameContext.getLabel("DEBUG_LEVEL_TIP"), 0, 3, true);
        p.add( dbgLevelField_ );
    }
View Full Code Here

TOP

Related Classes of com.barrybecker4.ui.components.NumberInput

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.