Blog of Andrés Aravena
CMB2:

# Homework 2

23 February 2019. Deadline: Friday, 1 March, 9:00.

Using R Turtle Graphics, write four functions to draw:

• A house
• A person
• A pentagon
• A polygon of N sides

To do so, you must use Rstudio to create a R Script file. The filename must be homework2.R.You can use this template as a starting point. The suggested function names are:

• draw_house <- function() {}
• draw_person <- function() {}
• draw_pentagon <- function() {}
• draw_polygon <- function(n) {}

Notice that only the last function takes an input value. The letter n represents how many sides are there in the polygon. With these functions you should be able to draw a figure like this:

Send your answer to andres.aravena+cmb@istanbul.edu.tr. Write your student number in the email’s Subject and at the beginning of the file.

# Hints

• Draw first in paper, so you can figure out the lengths and angles
• You can also print the figure and measure it with a meter
• Each drawing must start in the current mouse position, and in the current angle. If you want to draw two people, you can put the mouse in two positions and use draw_person() twice.
• The suggested size of the door is 10 by 20. The suggested roof’s angle is 45 degrees.