INQ241B
Mobile Apps

Activity 3

Variables

  1. Create a new script that uses a Turtle and a for loop with variables to draw a square spiral. The spiral should look something like this:

    square_spiral
    Note that the turn angle is always the same, but the distance the turtle travels increases. You will need a variable for the distance the turtle travels that increases every iteration of the loop.

  2. Create a new script that uses a Turtle and a for loop with variables to draw a nautilus spiral. The sprial should look something like this:

    nautilus_spiral
    Note that both the turn angle and the the distance the turtle travels increases. You will need two variables, one for angle and one for distance, that change every iteration of the loop.

  3. Create a new script that uses a Turtle and for loops with variables to draw a series of squares. Each square should be a larger than the previous and at a different angle than the previous square. All of the squares should have one corner at the same location.

    The script should also have 3 variables at the top of the script, num squares, square size change, and square angle change. These variables specify what the drawing will look like. The num squares variable is the number of squares that will be drawn. The square size change variable is the ammount the square edge length increase between subsiquent squares. The square angle change variable is the ammount the square rotation increases between subsiquent squares. For example, if the variables are set as:

    num squares := 4
    square size change := 20
    square angle change := 30

    then the script would draw:

    square_nautilus_4_20_30
    If they are set as:

    num squares := 20
    square size change := 5
    square angle change := 15

    then the script would draw:

    square_nautilus_20_5_15

Submission

Please show your source code and run your scripts for the instructor or lab assistant.