Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

Unlock your academic potential

© 2024 | Zucol Services PVT LTD | All rights reserved.

Added on 2019/09/18

|1

|393

|487

Project

AI Summary

This assignment is about implementing an L-system, specifically Sierpinski's Arrowhead Curve, using an AnimatedTurtle to draw the generated string. The L-system has a predefined alphabet and initial generation, along with production rules for transforming one generation into another. The goal is to create a Java program that implements these rules without using recursion.

Your contribution can guide someone’s learning journey. Share your
documents today.

Background

In the late 1960's the biologist and botanist, Aristid Lindenmayer, created L-systems (Links to an

external site.) to describe and model plant growth. He published a book entitled The 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 rules

for 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 the

production.

So here is a full look at nextGen for "+B−A−B+":

Character Production

rule Result so far

+ none +

B B → −A+B+A− +−A+B+A−

- none +−A+B+A−-

A A → +B−A−B+ +−A+B+A−-+B−A−B+

- none +−A+B+A−-+B−A−B+-

B B → −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.

Requirements

Download, unzip, and open the starter project in IntelliJ. You must fill in the methods in the

ArrowheadCurve.java file.

Your program must not use recursion.

You must implement each of the methods in ArrowheadCurve.java that have TODO comments.

What to Submit

Submit only your ArrowheadCurve.java file.

In the late 1960's the biologist and botanist, Aristid Lindenmayer, created L-systems (Links to an

external site.) to describe and model plant growth. He published a book entitled The 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 rules

for 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 the

production.

So here is a full look at nextGen for "+B−A−B+":

Character Production

rule Result so far

+ none +

B B → −A+B+A− +−A+B+A−

- none +−A+B+A−-

A A → +B−A−B+ +−A+B+A−-+B−A−B+

- none +−A+B+A−-+B−A−B+-

B B → −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.

Requirements

Download, unzip, and open the starter project in IntelliJ. You must fill in the methods in the

ArrowheadCurve.java file.

Your program must not use recursion.

You must implement each of the methods in ArrowheadCurve.java that have TODO comments.

What to Submit

Submit only your ArrowheadCurve.java file.

1 out of 1