Background. In the late 1960's the biologist and botani

Added on - 18 Sep 2019

  • 1


  • 393


  • 252


  • 0


Trusted by +2 million users,
assist thousands of students everyday
Showing pages 1 to 1 of 1 pages
BackgroundIn the late 1960's the biologist and botanist, Aristid Lindenmayer, createdL-systems(Links to anexternal site.)to describe and model plant growth.He published a book entitledThe AlgorithimicBeauty of Plants, that shows the use of these systems (see link to PDF in modules on Canvas).An L-system consists of an alphabet which is simply a String containing the characters used, a initial(or axiom) String consisting of characters from the alphabet, and then a collection of production rulesfor transforming one generation into another.On this exam, you will only be dealing with one particular L-system --Sierpinski's Arrowhead Curve.So in this case the alphabet consists of "AB+-".The initial generation is "A".The production rulesare (A → +B−A−B+), (B → −A+B+A−).This means that when nextGen is called with "A", the onlyrule that applies is the first production rule and so a new String is created that contains only"+B−A−B+".If nextGen were called on that, the process is the same -- namely for each characterwe look at the production rules to see if one applies and then replace that in the result string with theproduction.So here is a full look at nextGen for"+B−A−B+":CharacterProductionruleResult so far+none+BB → −A+B+A−+−A+B+A−-none+−A+B+A−-AA → +B−A−B++−A+B+A−-+B−A−B+-none+−A+B+A−-+B−A−B+-BB → −A+B+A−+−A+B+A−-+B−A−B+-−A+B+A−+none+−A+B+A−-+B−A−B+-−A+B+A−+So the result of nextGen("+B−A−B+") is "+−A+B+A−-+B−A−B+-−A+B+A−+".Given a String that represents a generation, you can use an AnimatedTurtle to draw that String byfollowing the rules that A and B mean move forward and + means turn left 60 degrees and - meansturn right 60 degrees.RequirementsDownload, unzip, and open the starter project in IntelliJ.You must fill in the methods in file.Your program must not use recursion.You must implement each of the methods in that have TODOcomments.What to SubmitSubmit only your file.
You’re reading a preview
Preview Documents

To View Complete Document

Become a Desklib Library Member.
Subscribe to our plans

Download This Document