Highlights
Task 3A: Sierpinski’s Triangle - Direct Drawing (COMP1100 only: 25 marks)
Sierpinski’s Triangle is a famous fractal (self-similar structure). We can generate approximations to Sierpinski’s Triangle using the following rules:
1. An approximation at depth 1 is a single equilateral triangle.
2. An approximation at depth n is made up of three approximations at depth n - 1, with their side length reduced by half. These approximations are arranged to cover the original triangle. We can draw approximations to Sierpinski’s triangle using our turtle system (click for larger versions):
Your Task
Define a function Sierpinski:: Int -> Double -> [TurtleCommand] in src/Turtle.hs, which generates the necessary commands to draw an approximation to Sierpinski’s Triangle. The first argument specifies the depth, and the second specifies the side length. The turtle should finish with the same position and facing as when it started.
Hints
• Be very clear in your mind about what happens at each level. Trace out a path for the turtle on graph paper, using the diagrammed behaviour as a guide. Actual drawing only happens at depth 1, and the other levels of the recursion position the turtle without drawing.
• It’s very important that the turtle finishes with the same position and facing as when it started because that’s how you know where it will be when you come out of a recursive call.
• If you get stuck, try writing out the steps for drawing a depth-2 approximation without recursion (but following the diagram closely), then look for subsequences that look like the instructions to draw a depth-1 approximation.
Task 3B: L-Systems
During his study of filamentous fungi and other simple biological structures, Hungarian biologist Astrid Lindenmayer invented a type of formal language that can model their development. These languages have come to be called L-Systems, and are comprised of three parts:
1. An alphabet of symbols.
2. An initial string, consisting of symbols from that alphabet.
3. A production rule which we apply to every symbol, to derive the next generation. If our rule does not mention a symbol, we send that symbol to itself.
This Computer Science Assessment has been solved by our Computer Science experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.