L-systems: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 31: Line 31:
var t = new JSXTurtleObj(brd);
var t = new JSXTurtleObj(brd);


var axiom = '';
var LSystem = "
var rules = {};
var generator = {};
 
function expander(level) {
function expander(level) {
     this.source = (level>1) ? new expander(level-1) : (new function() {
     this.source = (level>1) ? new expander(level-1) : (new function() {
Line 90: Line 87:
     return null;
     return null;
}
}
";


function run() {
function run() {
Line 98: Line 96:
   t.hideTurtle();
   t.hideTurtle();
   eval(code);
   eval(code);
  eval(LSystem);
   var generator = new expander(level,axiom,rules);
   var generator = new expander(level,axiom,rules);
   plotter();
   plotter();

Revision as of 18:32, 30 December 2008