Skip to main content

Section 8.7 Summary & Reading Questions

  • Turtles, originally from the Logo programming language, is used as an educational tool. It relates to a conceptual “turtle” that runs around on a canvas and draws things.
  • Python’s turtle is a great way to start coding, and until recently, C++ did not have the capability of such a library due to the complexity and required understanding of its syntax.
  • Turtles have a variety of commands that are self-describing such as “forward” or “back”. Almost everything that was available to use in Python for Turtles is also available in C++.
  • The two versions of the Turtle library differ mainly in syntax, such as differences in entering color codes, and the limited variety of preset shapes available in C++. However, C++ has a few extra utilities not available in Python.
  • Turtles provide methods to alter their inner workings, including some control over how many frames of animation are shown with tracer method.
  • Every shape created and used by Turtles are a set of coordinates. We can change the shape of our turtles by using the shape method to one of four default shapes, or by manually entering coordinates and creating your own.

Reading Questions Reading Question

1.

2.

3.

How large would the undo queue be for the above code example?
  • 13
  • No, think about how many times fill is used...
  • 10
  • Correct!
  • Incorrect! Consider that almost everything a turtle does is an action, even filling.
  • Incorrect! Consider that there are some actions in a for loop.
#include <CTurtle.hpp>
namespace ct = cturtle;

int main() {
    ct::TurtleScreen scr;
    ct::Turtle turtle(scr);

    for(int i = 0; i < 5; i++){
        turtle.forward(50);
        turtle.right(144);
    }

    scr.bye();
    return 0;
}

4.

What kind of shape does the above activecode create?
  • Circle
  • Incorrect! Consider how many times the for-loop iterates...
  • No shape
  • Incorrect! The turtle’s pen is always down.
  • Pentagon
  • Incorrect! Consider the angle the turtle turns every iteration.
  • Star
  • Correct!

5.

You can have more than one turtle on one screen.
  • True
  • Correct!
  • False
  • Incorrect!
You have attempted 1 of 5 activities on this page.