Package com.barrybecker4.simulation.reactiondiffusion.rendering

Examples of com.barrybecker4.simulation.reactiondiffusion.rendering.RDRenderingOptions


        drawGrid(g2, board);

        Location topLeftCorner = board.getBoundingBox().getTopLeftCorner();

        for (Location loc : board.getTantrixLocations()) {
            TilePlacement placement = board.getTilePlacement(loc);
            tileRenderer.render(g2, placement, topLeftCorner, hexRadius);
        }
    }
View Full Code Here


            optimizer.doOptimization(strategy, initialGuess, SOLVED_THRESH);

        solution_ =
            new TantrixBoard(((TantrixPath)solution).getTilePlacements(), board.getPrimaryColor());

        TilePlacementList moves;
        if (evaluateFitness(solution) >= SOLVED_THRESH) {
            moves = ((TantrixPath)solution).getTilePlacements();
        } else {
            moves = null;
        }
View Full Code Here

        int numTiles = path.size();
        double distance = path.getEndPointDistance();
        boolean isLoop = distance == 0 && path.isLoop();

        ConsistencyChecker checker = new ConsistencyChecker(path.getTilePlacements(), path.getPrimaryPathColor());
        int numFits = checker.numFittingTiles();
        boolean allFit = numFits == numTiles;
        boolean consistentLoop = isLoop && allFit;
        boolean perfectLoop = false;
        double compactness = determineCompactness(path);
View Full Code Here

        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

        add(fill);
    }

    private JPanel createCheckBoxes() {

        RDRenderingOptions renderingOptions = simulator_.getRenderingOptions();
        showU_ = new JCheckBox("U Value", renderingOptions.isShowingU());
        showU_.addActionListener(this);

        showV_ = new JCheckBox("V Value", renderingOptions.isShowingV());
        showV_.addActionListener(this);

        useComputeConcurrency_ =
                createCheckBox("Parallel caclulation",
                               "Take advantage of multiple processors for RD calculation if checked.",
                               gs_.isParallelized());

        useRenderingConcurrency_ =
                createCheckBox("Parallel rendering",
                              "Take advantage of multiple processors for rendering if checked.",
                              renderingOptions.isParallelized());

        useFixedSize_ =
                createCheckBox("Fixed Size",
                               "Use just a small fixed size area for rendering rather than the whole resizable area.",
                               simulator_.getUseFixedSize());
View Full Code Here

    /**
     * One of the buttons was pressed.
     */
    public void actionPerformed(ActionEvent e) {
        RDRenderingOptions renderingOptions = simulator_.getRenderingOptions();

        if (e.getSource() == showU_) {
            renderingOptions.setShowingU(!renderingOptions.isShowingU());
        }
        else if (e.getSource() == showV_) {
            renderingOptions.setShowingV(!renderingOptions.isShowingV());
            repaint();
        }
        else if (e.getSource() == useComputeConcurrency_) {
            boolean isParallelized = !gs_.isParallelized();
            gs_.setParallelized(isParallelized);
        }
        else if (e.getSource() == useRenderingConcurrency_) {
            boolean isParallelized = !renderingOptions.isParallelized();
            renderingOptions.setParallelized(isParallelized);
        }
        else if (e.getSource() == useFixedSize_) {
            simulator_.setUseFixedSize(useFixedSize_.isSelected());
        }
    }
View Full Code Here

TOP

Related Classes of com.barrybecker4.simulation.reactiondiffusion.rendering.RDRenderingOptions

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.