  NEW Order Assignment Online and Get Upto 50%* OFF !!!

# COMP1100 Assignment 2 Turtle Graphics Answer The students in COMP1100 assignment 2 turtle graphics have to rethink the graphics, the one about the robotic turtle. There are a number of tasks like drawing the shapes, to interpret the turtle commands, directly drawing the Sierpinski’s triangle and creating the L-systems in this assignment. For this, you need expertise of a computer science assignment help provider. In this assignment, you need to draw a picture with turtle graphics. The commands need to be typed for drawing the shape and you also have to think of a way to interpret these commands.

In this task, you have to define the following two functions in src/Turtle.hs –

### triangle :: Double -> [TurtleCommand]

This function should be able to return a command list. Using this command, you have to draw an equilateral triangle. The face of the turtle should be the same as it was when the turtle started.

### polygon :: Int -> Double -> [TurtleCommand]

In this command, you should be able to draw a regular n-sided polygon. This polygon will have the sides that are of length s. Like the command above, your turtle’s face should be in the same position as it was when it started.

The command should be such that the program does not accept a value of n which is less than 3. The commands that you wrote in the task above are data and set of instructions. The usefulness of these commands is that they will generate an output when you pass them through an interpreter.

In the COMP1100 assignment 2 answer for task 2, you need to define a function runTurtle :: [TurtleCommand] -> Picture. The command will be created as per the rules as defined in Task 1.

Place the turtle at 0,0 facing north and run the program. After successful completion of this task, your result will look like the image below – To prepare the command for this task, you should know what the turtle has done. It might happen that when you prepare the command and input FORWARD, the forward direction for the turtle maybe towards the right or left.

It is better if you define a command that sets a default position for the turtle. The default command will bring the turtle back to an initial face, direction and coordinates, irrespective of its previous position.

In this COMP1100 assignment 2 answers of Task 3A, you need to prepare a Sierpinski’s Triangle. Sierpinski’s Triangle is a fractal that has a parent shape of an equilateral triangle and is then recursively divided into smaller equilateral triangles.

The assignment task is as below – You need to draw an approximation of the Sierpinski’s Triangle using commands. The university understands that you cannot reproduce it but only asks you to produce a close looking fractal.

The specifications of the task are defined as a single equilateral triangle is present at depth 1.

The other condition for the Sierpinski’s Triangle is the approximation when the depth is n and is made up of three different approximations made at n-1. The side length is reduced by 50% and all these approximations are arranged so that the original triangle is covered.

The approximate version of Sierpinski’s Triangle using the turtle commands will look something like the image below –  In this task, you need to define a function which will give you all the commands that are necessary to draw the Sierpinski’s Triangle. Every level of the triangle making should be clear to you. To understand it better, you better draw one on a piece of paper and then think how the turtle will advance. 