PencilCoder

Line Art!

Goals:

  • Use straight lines to draw geometric figures and make art

Coding Snippets:

  • coding snippets
  • Change the second argument of the pen function to a different number to change the pen width.
  • pu and pd stand for "pen up"and "pen down".
  • The fill function fills in the region traced by the turtle since the most recent call to the pen function.
  • For a list of some additional colors, see https://ref.pencilcode.net/turtle/colors.html

Math and Computer Concepts:

  • For this lesson, you will need to figure out the angles in shapes in order to know how many degrees to make the turtle turn. For example, consider an equilateral triangle (a triangle in which all three angles are the same). Because the interior angles of a triangle always add up to 180°, each angle in an equilateral triangle is 60°. However, if you make the turtle turn 60° after drawing each side, you will not draw a triangle, but this:
    BadAlgorithm
    To construct an equilateral triangle, you need to turn 120° each time. This angle has a special name: the supplement of 60°. It is computed as 180° − 60°.

Activities:

Save each of the following in a folder called LineArt.

Hint: in the activities involving shapes, try to identify an underlying pattern between the number of sides and the size of the angle you need to turn. (Don't simply "guess and check"!)

  • Complete a program which draws an equilateral Triangle.
  • Create a Square. Fill in your square with a different color than you used for the edge.
  • Draw a regular Pentagon and a regular Heptagon (seven sides!)
  • Triangle Blank space Square Blank space Pentagon Blank space Heptagon
  • There are various possible algorithms for drawing stars. Some only work for stars with an even or an odd number of points, while others work for any number of points. Draw a FivePointedStar and/or a SixPointedStar.
  • Draw your Initials or Dice or a PeaceSign or a House or some other creative design!