Goal: Find the turning angle to make a triangle.
Vocabulary: pd, rt (right), fd (forward), repeat, cg
repeat 3 [fd 80 rt angle]
- Make a slider called whatcolor. Set its minimum to 0 and its maximum to 140.
- Make another slider called angle. Set its minimum to 0 and its maximum to 180.
Write a procedure named triangle? as shown.
- Pd means "pen down" so that the turtle will draw a line wherever it moves.
- Setc whatcolor sets the turtle's color to the number on the whatcolor slider.
- Repeat 3 means, "Repeat the instruction list three times."
Fd 80 means, "Move forward 80 tiny turtle steps."
- Rt angle means, "Turn right the number of degrees on the angle slider."
Write a reset procedure.
- Cg means "clear graphics." It erases everything drawn on the page and returns the turtle home (at the very center of the page).
- Make buttons with instructions triangle? and reset and set them to Once.
- Try different settings on the angle slider, and see if you can draw a triangle.
As you experiment with different inputs for angle, keep in mind that you are telling the turtle how many degrees to turn before drawing the next line segment. This is the "outside angle." To draw a sharp (acute) angle, does the turtle need to turn less than 90 degrees or more than 90 degrees?
Try setting the slider to different inputs (numbers) until the turtle draws a triangle. (Drag the turtle aside to see if the shape is closed.)
Drag the turtle to different positions and adjust the slider to create a scene out of 3-sided shapes.
On Your Own - Project Ideas
Can you make a house out of a square with a triangle for its roof? (You might need to write a square procedure, but you might be able to do it just with the triangle? procedure. How?)