/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package garten.model; /** * * @author Jan */ import lsystem.StochasticGrammar; class Pflanze3 extends PflanzeImpl { Pflanze3(int Xstart, int Ystart, int Generation,int startLength) //Unkraut 10-20, 4 Generations { super(Xstart,Ystart,Generation,startLength); DELTA = (float) ((Math.PI)/5); createLSystem(); translateRules(); } public void createLSystem() { grammar = new StochasticGrammar(axiom); grammar.addRule('F',"FF+[+F-F-F]-[-F+F+F]",(float) 0.1); // add rule, and weight grammar.addRule('F',"FF+[+F-F]-[-F+F]",(float) 0.45); grammar.addRule('F',"FF+[+F+F+F]-[-F+F]",(float) 0.3); grammar.generateGrammar(generations); drawLength = (float) (startLength * Math.pow(0.5, (double) generations)); } }