Solution for Weekly Programming Challenge #14 by Jamis Buck.
For normal mode (and one point), here’s all you’ve got to do:
- Given a starting statement and a set of rules, recursively perform the substitutions required by the rules. You must be able to specify how many times the substitutions will be performed.
- Draw the resulting statement! The only commands you need to support are “F” (move forward), “+” (turn right), and “-“ (turn left). You should be able to specify how much a “+” and “-“ will turn the turtle.
- Produce an image with the finished drawing.
That’s it! You’re going to have to tackle some math to make this work, and figuring out how large your canvas needs to be may be a bit of a puzzle, but it can be done! Try the dragon curve (above) as a test.