Examples of SimGenPoint


Examples of org.woehlke.simulation.evolution.beans.SimGenPoint

    private ESimGenDna orientation;

    private ISimGenLifeCycle lifeCycle;

    public SimGenCell(SimGenPoint max, SimGenPoint pos, Random random) {
        this.max = new SimGenPoint(max);
        this.pos = new SimGenPoint(pos);
        //this.random = new Random();
        //this.random.setSeed(random.nextLong());
        this.random = random;
        this.core = new SimGenCore(random);
        this.max.killNagative();
View Full Code Here

Examples of org.woehlke.simulation.evolution.beans.SimGenPoint

    public void move() {
        //if(!lifeCycle.isNotDyingForHunger())
        //{
        lifeCycle.move();
        getNextOrientation();
        SimGenPoint move = new SimGenPoint(0, 0);
        switch (orientation) {
            case FORWARD:
                move = new SimGenPoint(0, 2);
                break;
            case RIGHT:
                move = new SimGenPoint(2, 1);
                break;
            case RIGHT_RIGHT:
                move = new SimGenPoint(2, -1);
                break;
            case BACKWARDS:
                move = new SimGenPoint(0, -2);
                break;
            case LEFT_LEFT:
                move = new SimGenPoint(-2, -1);
                break;
            case LEFT:
                move = new SimGenPoint(-2, 1);
                break;
        }
        pos.add(move);
        pos.add(max);
        pos.normalize(max);
View Full Code Here

Examples of org.woehlke.simulation.evolution.beans.SimGenPoint

        return child;
    }

    private SimGenCell(int fat, ISimGenCore rna, SimGenPoint pos, SimGenPoint max, Random random) {
        lifeCycle = new SimGenLifeCycle(fat);
        this.max = new SimGenPoint(max);
        this.pos = new SimGenPoint(pos);
        this.random = random;
        this.core = rna;
        orientation = getRandomOrientation();
    }
View Full Code Here

Examples of org.woehlke.simulation.evolution.beans.SimGenPoint

    private ArrayList<SimGenPoint> positions;
    SimGenPoint max;

    public SimGenWorld() {
        worldMapFood = new int[X][Y];
        max = new SimGenPoint(X, Y);
        createPopulation();
    }
View Full Code Here

Examples of org.woehlke.simulation.evolution.beans.SimGenPoint

    public SimGenWorld(int x, int y) {
        X = x;
        Y = y;
        worldMapFood = new int[X][Y];
        max = new SimGenPoint(X, Y);
        createPopulation();
    }
View Full Code Here

Examples of org.woehlke.simulation.evolution.beans.SimGenPoint

                x *= -1;
            }
            if (y < 0) {
                y *= -1;
            }
            SimGenPoint pos = new SimGenPoint(x, y);
            ISimGenCell cell = new SimGenCell(max, pos, random);
            cells.add(cell);
        }
    }
View Full Code Here

Examples of org.woehlke.simulation.evolution.beans.SimGenPoint

        }
    }

    public void letLivePopulation() {
        letFoodGrow();
        SimGenPoint pos;
        ArrayList<ISimGenCell> children = new ArrayList<ISimGenCell>();
        Iterator<ISimGenCell> i = cells.iterator();
        while (i.hasNext()) {
            ISimGenCell cell = i.next();
            cell.move();
            pos = cell.getPos();
            int x = pos.getX();
            int y = pos.getY();
            if (hasFood(x, y)) {
                cell.eat();
                worldMapFood[x][y]--;
            }
            if (cell.isPregnant()) {
                ISimGenCell child = cell.cellDivisionFactory();
                children.add(child);
            }
        }
        cells.addAll(children);
        positions = new ArrayList<SimGenPoint>();
        i = cells.iterator();
        while (i.hasNext()) {
            ISimGenCell cell = i.next();
            SimGenPoint p = cell.getPos();
            positions.add(p);
        }
    }
View Full Code Here

Examples of org.woehlke.simulation.evolution.beans.SimGenPoint

    Color water = Color.BLACK;
    Color food = Color.GREEN;
    Color bazillus = Color.RED;

    public SimGenWorldCanvas(int x, int y) {
        this.dimensions = new SimGenPoint(x, y);
        this.setBackground(water);
        this.setSize(x, y);
    }
View Full Code Here

Examples of org.woehlke.simulation.evolution.beans.SimGenPoint

        }
        g.setColor(bazillus);
        ArrayList<SimGenPoint> population = world.getPositionsOfAllCells();
        Iterator<SimGenPoint> it = population.iterator();
        while (it.hasNext()) {
            SimGenPoint p = it.next();
            g.fillRect(p.getX() - 1, p.getY() - 1, 3, 3);
        }
    }
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.