September 14th, 2013, 04:44 PM
Join Date: Sep 2013
Time spent in forums: 38 m 14 sec
Reputation Power: 0
Help with new school assignment (Part 1 of the lindemayer system)
So we are doing fractals, but we are only doing part 1. Let me post my assignment and then see if anyone can get me started on it.
This Lab is Part 1 of building a type of fractal called a Lindenmayer system.
In this first part, you will just be implementing symple set of draw commands.
Write a program that takes 3 inputs:
1) Draw String: This must be a string of draw commands (see the table below).
2) Length: This must be an integer equal greater than 0 and less than or equal to 100. It defines the length variable used in some of the draw commands.
3) Angle: This must be a floating point number equal greater than 0.0 and less than or equal to 360.0. It defines the angle variable used in some of the draw commands.
Character Draw Commands
Draw a straight line segment length pixels long in the current heading.
Same as h
Move, without drawing, a straight line segment length pixels long in the current heading.
Turn the heading clockwise by angle.
Turn the heading counter-clockwise by angle.
Each of these color commands must change the turtle color to color that is different form the background and different from the other 5 color commands. Pick colors that you think look good together.
any other character
Ok, I have been reading my textbook, but it unfortunately doesn't really tell you how to actually do this assignment. Could someone maybe give me some help one how to code this stuff, I am really lost on this one, and could really use the help.
PS. Here is one last thing our professor mentions in the assignment:
Now that you have the "if" statement at your command, you do need to check for for bad input. If the user inputs bad data, print an error message and exit the program.