Ask a question to Desklib · AI bot


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

Added on -2019-09-18

| 1 pages
| 393 words

Trusted by 2+ million users,
1000+ happy students everyday

BackgroundIn the late 1960's the biologist and botanist, Aristid Lindenmayer, createdL-systems(Links to an external site.)to describe and model plant growth. He published a book entitledThe Algorithimic Beauty 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 rules are (A → +B−A−B+), (B → −A+B+A−). This means that when nextGen is called with "A", the only rule 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 character we 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 by following the rules that A and B mean move forward and + means turn left 60 degrees and - means turn right 60 degrees.RequirementsDownload, unzip, and open the starter project in IntelliJ. You must fill in the methods in the file.Your program must not use recursion.You must implement each of the methods in that have TODO comments.What to SubmitSubmit only your file.

Found this document preview useful?

You are reading a preview
Upload your documents to download
Become a Desklib member to get accesss

Students who viewed this