Blog of Andrés Aravena
CMB2:

Homework 3

01 March 2019. Deadline: Friday, 8 March, 9:00.

Figure 1. You should see something like this.

As we discussed in class, advanced software engineering uses stick-people to model actors in “use case scenarios”. You can learn more looking for Universal Modeling Language. We want to draw one or more stick-people with the following function

Figure 2. You can also draw something like this.

draw_person <- function(size) {
    draw_head(size*1.2)
    turtle_left(180)
    turtle_forward(size)
    turtle_left(90)
    draw_arm(size*1.5)
    turtle_left(180)
    draw_arm(size*1.5)
    turtle_left(90)
    turtle_forward(size*2)
    turtle_left(20)
    draw_leg(size*2)
    turtle_right(40)
    draw_leg(size*2)
}

Your task is to write the functions draw_head(), draw_arm() and draw_leg(). They should look like Figure 1, but you can make creative modifications, like hands with fingers, hair, etc.

The most important issue is that each of your functions must leave the turtle in the same position and the same angle as before. Your function can move the turtle as you wish, but it must leave the turtle as it was at the beginning of the function.

Delivery

Please send me the homework-3.R file in an email to andres.aravena+cmb@istanbul.edu.tr. Do not forget to write your name and number.

Deadline: Friday, 8 March, 9:00.

Originally published at https://anaraven.bitbucket.io/blog/2019/cmb2/homework-3.html