#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    4
    Rep 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.

    assignment:

    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
    h
    Draw a straight line segment length pixels long in the current heading.
    f
    Same as h
    g
    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.
    A
    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.
    B
    C
    D
    E
    F
    any other character
    Ignore
    (end)

    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.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,996
    Rep Power
    481
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo