'L-SystemOption Explicit
'OPTION EXPLICIT forces you to declare variables with the DIM or REDIM statement'OPTION EXPLICIT should always be the first line in the code'Script written by Charles Portelli'Script version Wednesday, August 29, 2007 3:05:53 PM'Using the apostrophe allows for comments to be added in to the code'Comments are usefull because they allow us to add notes to the code'that do not affect the execution of the code'GLOBAL Variables = variables that are used through out the code'Always declare you global variables in the begining'--------------------------------------------Dim axiom : axiom = "abc" 'declaring the axiomDim numberOfGenerations : numberofgenerations = 6 'declaring the number of generationsReDim rules(2,1) 'declaring the rulesrules(0,0) = "a" 'A -> B the letter A gets replaced with the letter Brules(0,1) = "b"rules(1,0) = "b" 'B -> A the letter B gets replaced with the letter Arules(1,1) = "a"rules(2,0) = "c" 'C -> AA the letter C gets replaced with the letters AArules(2,1) = "aa"'--------------------------------------------Call Main() 'this tells the computer to go to the MAIN SUB hence Call MainSub Main()Dim i,j 'this is where you declare you local variablesDim arrPoint, x,y,zx=0 : y=0 : z=0'perform the string replacement for each generationFor j=0 To numberOfGenerationsrhino.print axiom 'print the axiom in the command line'draw each generationFor i=1 To len(axiom) 'for every letter in the axiomarrPoint = array(j,i-1,z)rhino.addTextDot Mid(axiom, i, 1), arrPoint 'add a text dot with each letter from the axiomNextFor i=0 To Ubound(rules,1) 'for each of the rules in the first dimension'a match is converted into a numberaxiom = Replace(axiom, rules(i,0), i) 'take the letter in the axiom and replace it with a numberNextFor i=0 To Ubound(rules,1)'the number is replaced with the result of the substitution ruleaxiom = Replace(axiom, i, rules(i,1)) 'now replace that number based on your rulesNextNextRhino.Print("finished!") 'when finished display FINISHED in the command lineEnd Sub 'this marks the end of the MAIN SUB