lab9

Lab 9 Write-up

Task:

The task for this lab was to create methods for a class that allows the user to set different components of L-systems. The class allows the user to set the values of the L-system fields, set the number of iterations, set the distance for the L-system, and set the angle for the L-system. The user can also access the distance, and angle fields. After creating the class the task was to create a drawing using three different l-systems.

Fields in the L-System Object

The L-system object contains the baseString, rules, iterations, angle, and distance fields. The baseString field holds a string. The rules field holds a list of a list. The iterations field holds an integer, and both the distance and angle fields hold floats.

Final Scene

Description of Algorithm for Final Scene

For my final scene I set the L-system fields, then used moved the turtle using the up, goto and down functions. Then I reset the heading, and then drew the plant using the process string function. I repeated this six times, one for each of the plants.

L-Systems used in Final Scene

Tree1

BaseString:F

Rules:[['F','F[+F]F[-F]F']]

Iterations:5

Angle:23.5

Distance:1.75

Tree2

BaseString:F

Rules:[['F', 'fF[+FL]F[-FL][FL]']]

Iterations:4

Angle:22.5

Distance:2.5

Tree3

BaseString:F

Rules:[['F', 'fF[+FL]F[-FL][FL]']]

Iterations:4

Angle:22.5

Distance:7

Tree4

BaseString:F

Rules:[['F','F[+F]F[-F][F]']]

Iterations:5

Angle:20

Distance:7

Tree5

BaseString:F

Rules:[['F','F[+F]F[-F]F']]

Iterations:5

Angle:23.5

Distance:1.9

Tree6

BaseString:F

Rules:[['F', 'fF[+FL]F[-FL][FL]']]

Iterations:4

Angle:22.5

Distance:3.5