Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with homework assignment (lindenmayer system)
#1
Ok so I am struggling in this computer programming class, as I am totally new to computer programming. let me post my actual assignment and then see if anyone could help get me started with 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

So, that is the assignment, sorry it's so long. I have been reading my textbook, and unfortunately it gives very little info on how to actually do this assignment. It also didn't help that our professor showed us all these cool things fractals could do, but didn't actually tell us anything about how to do the assignment (don't ask me why?)

I am really at a loss as to how to even begin to code this thing, if someone could help me or at least point me in the right direction, at starting to go about coding for this stuff, it would really help me out. I don't expect anyone to do it all for me, just maybe help show me where to begin.

PS. There is one other thin our professor wrote that is probably important.

Now that you have the "if" statement at your command, you do need to check for bad input. If the user inputs bad data, print an error message and exit the program.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED]Referenced before assignment? uber1337 1 1,606 04-05-2010, 06:17 PM
Last Post: Fallen

Forum Jump:


Users browsing this thread: 1 Guest(s)