Examples of Universe


Examples of barsuift.simLife.universe.Universe

        return currentUniverse;
    }

    public Universe createRandomUniverse() {
        BasicUniverseFactory factory = new BasicUniverseFactory();
        Universe universe = factory.createRandom();
        this.currentUniverse = universe;
        this.currentSaveFile = null;
        this.window.changeUniverse(currentUniverse);
        return currentUniverse;
    }
View Full Code Here

Examples of barsuift.simLife.universe.Universe

    }


    public Universe openUniverse(File saveFile) throws OpenException {
        BasicUniverseIO envIO = new BasicUniverseIO(saveFile);
        Universe universe = envIO.read();
        this.currentUniverse = universe;
        this.window.changeUniverse(currentUniverse);
        this.currentSaveFile = saveFile;
        return currentUniverse;
    }
View Full Code Here

Examples of barsuift.simLife.universe.Universe

        super();
        setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
        setMaximumSize(new Dimension(220, 100));
        setAlignmentX(Component.CENTER_ALIGNMENT);

        Universe universe = universeContext.getUniverse();
        dateDisplay = new DateDisplay(universe.getDate());
        dateDisplay.setAlignmentX(Component.CENTER_ALIGNMENT);
        add(dateDisplay);

        MainSynchronizer synchronizer = universeContext.getSynchronizer();
        JPanel speedPanel = createSpeedPanel(synchronizer);
View Full Code Here

Examples of ca.nengo.ui.lib.world.piccolo.primitives.Universe

        restoreDefaultTitle();

        actionManager = new ReversableActionManager(this);
        getContentPane().setLayout(new BorderLayout());

        universe = new Universe();
        universe.setMinimumSize(new Dimension(200, 200));
        universe.setPreferredSize(new Dimension(400, 400));
        universe.initialize(createWorld());
        universe.setFocusable(true);
View Full Code Here

Examples of ca.nengo.ui.lib.world.piccolo.primitives.Universe

        Component ng = NengoGraphics.getInstance();
       
        if (fileChooser.showSaveDialog(ng)==JFileChooser.APPROVE_OPTION) {
            File file = fileChooser.getSelectedFile();

            Universe universe = ((NengoGraphics) ng).getUniverse();
            double w = universe.getSize().getWidth();
            double h = universe.getSize().getHeight();

            // Top of page method: prints to the top of the page
            float pw = 550;
            float ph = 800;
   
            // create PDF document and writer
           Document doc = new Document();
           try{
             PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(file));
             doc.open();

            PdfContentByte cb = writer.getDirectContent();

            // create a template
            PdfTemplate tp = cb.createTemplate(pw,ph);
            Graphics2D g2 = tp.createGraphicsShapes(pw,ph);

            // scale the template to fit the page
            AffineTransform at = new AffineTransform();
            float s = (float) Math.min(pw/w,ph/h);
            at.scale(s,s);
            g2.setTransform(at);

            // print the image to the template
            // turning off setUseGreekThreshold allows small text to print
            Text.setUseGreekThreshold(false);
            universe.paint(g2);
            Text.setUseGreekThreshold(true);
            g2.dispose();

            // add the template
            cb.addTemplate(tp,20,0);
View Full Code Here

Examples of com.heatonresearch.aifh.examples.ca.mergelife.universe.Universe

        final int width = MultiverseViewer.getConfig().getPaneWidth()
                / MultiverseViewer.getConfig().getZoom();
        final int height = MultiverseViewer.getConfig().getPaneHeight()
                / MultiverseViewer.getConfig().getZoom();

        final Universe universe = new Universe(height, width, 3);
        final Physics physics = new MergePhysics(universe);

        universe.randomize(rnd);
        physics.randomize();

        this.universeRunner = new UniverseRunner(universe, physics);
        this.visualizer = new UniverseVisualizer(universe,
                MultiverseViewer.getConfig().getZoom());
View Full Code Here

Examples of com.heatonresearch.aifh.examples.ca.mergelife.universe.Universe

    @Override
    public void componentResized(final ComponentEvent e) {
        final int width = getWidth() / this.zoom;
        final int height = getHeight() / this.zoom;

        final Universe universe = new Universe(height, width, 3);
        final Physics physics = new MergePhysics(universe);
        physics.copyData(this.sourceData);
        universe.randomize(this.rnd);
        this.runner = new UniverseRunner(universe, physics);
        this.visual = new UniverseVisualizer(universe, this.zoom);

        if (!this.running) {
            this.running = true;
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

    private Random randomGenerator = new Random();

    @RequestMapping("/new")
    public ModelAndView newGame() {
        ModelAndView mav = new ModelAndView("game/edit");
        Universe universe = new Universe();
        mav.addObject("universe", universe);
        thinkABit(250);
        return mav;
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

    @RequestMapping("/start")
    public ModelAndView firstGeneration(@RequestParam("rows") final int rows,
                                        @RequestParam("columns") final int columns,
                                        final HttpServletRequest request) {

        Universe universe = universeInstanciatedFromClickedCells(rows, columns, request);
        thinkABit(200);

        return showGridScreen(universe);
    }
View Full Code Here

Examples of com.wakaleo.gameoflife.domain.Universe

    @RequestMapping("/next")
    public ModelAndView nextGeneration(@RequestParam("rows") final int rows,
                                       @RequestParam("columns") final int columns,
                                       final HttpServletRequest request) {

        Universe universe = universeInstanciatedFromClickedCells(rows, columns,
                request);
        universe.createNextGeneration();

        thinkABit(250);

        return showGridScreen(universe);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.