Examples of PlantUniverse


Examples of com.heatonresearch.aifh.examples.capstone.alife.milestone1.PlantUniverse

        genetic.addOperation(0.9, new Splice(PlantUniverse.GENOME_SIZE / 3));
        genetic.addOperation(0.1, new MutatePerturb(0.1));

        // Display

        this.universe = new PlantUniverse();
        this.universe.reset();


        DoubleArrayGenome bestGenome = (DoubleArrayGenome) genetic.getBestGenome();
        PlantPhysics physics = new PlantPhysics();
View Full Code Here

Examples of com.heatonresearch.aifh.examples.capstone.alife.milestone1.PlantUniverse

     * {@inheritDoc}
     */
    @Override
    public double calculateScore(final MLMethod algo) {
        DoubleArrayGenome genome = (DoubleArrayGenome) algo;
        PlantUniverse universe = new PlantUniverse();
        universe.reset();
        PlantPhysics physics = new PlantPhysics();
        PlantGrowth growth = new PlantGrowth();

        // Run the generations.
        for (int i = 0; i < PlantUniverse.EVALUATION_CYCLES; i++) {
            physics.runPhysics(universe);
            growth.runGrowth(universe, genome.getData());
        }

        // Count the amount of green.
        int count = 0;
        double sum = 0;
        for (int row = 0; row < PlantUniverse.UNIVERSE_HEIGHT; row++) {
            for (int col = 0; col < PlantUniverse.UNIVERSE_WIDTH; col++) {
                PlantUniverseCell cell = universe.getCell(row, col);
                if (cell.isAlive()) {
                    if (row >= PlantUniverse.GROUND_LINE) {
                        sum += 0.5;
                    } else {
                        sum += cell.getLeafyness();
View Full Code Here

Examples of com.heatonresearch.aifh.examples.capstone.alife.milestone1.PlantUniverse

     * Constructor.
     */
    public Milestone2Main() {
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

        this.universe = new PlantUniverse();
        this.universe.reset();

        this.display = new DisplayPlant();
        this.display.setUniverse(this.universe);
        this.getContentPane().add(this.display);
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.