module A; const double angle = 30; int maxLines = 100; protected void init () [ Axiom ==> for ((1:30)) ( [ RU(random(0, 360)) RL(random(-90, 90)) A() ] ) ; ] public void run () [ a:A ==> // change direction away from center { // calculate direction from center to growing tip // since the center is (0, 0, 0) the direction is // just the location of the tip Vector3d v = new Vector3d(location(a)); // calculate length of the vector v double length = v.length(); // normalize the direction to a length of 1 v.normalize(); } tropism(a, v, 0.1) // grow F(0.4) // randomly change direction RU(random(-angle, angle)) RL(random(-angle, angle)) // check if still inside the sphere if (length < 10) ( // create a new line with a certain probability // but at most maxLines additional lines if (probability(0.05) && (maxLines > 0)) ( [ A { maxLines--; } ] ) // then reinsert growing tip a ) else ( // otherwise mark end of growing Sphere(0.2) ) ; ]