Center Home -> Content Areas Home -> Math Home -> Project Activities -> Microworlds Activities ->

Drawing Polygons with MicroWorlds

Activity Description Activity Guide


Part 1: Interpreting Logo Commands

In MicroWorlds, every word you type into the command center is interpreted as a request for the "turtle" to do something.

  • Use your pencil to draw the path the turtle would take if given the following code.

      pd
      rt 90
      fd 15
      lt 90
      FD 10
      lt 90
      FD 10
      rt 90
      FD 10

      rt 90
      FD 30
      rt 90
      FD 10
      rt 90
      FD 10
      lt 90
      FD 10
      lt 90
      FD 15
      lt 90

  • Enter this code into the MW command center and observe the actions of the turtle at each step.

  • Compare your pencil drawn path to the one drawn by the turtle.

Part 2: Exploring Line Segments & Polygons

  • Draw a line segment of length one turtle step. Then drag the turtle or hide the turtle to see this segment. Repeat this for ten turtle steps.

  • Estimate the dimensions of a MW page in turtle steps. Type in code to move the turtle across the page to determine the width and length of the page in turtle steps.

  • Instruct the turtle to draw your first initial. Comment on the commands you used.

  • Draw a square with an area of 2500 square turtle steps. Discuss your code and resultant figure with your neighbor.

  • Draw an equilateral triangle with sides of length 65 turtle steps. Discuss your code and resultant figure with your neighbor. How did the code differ for the equilateral triangle versus the square?

  • Create a regular pentagon. Discuss your code and resultant figure with your neighbor.

  • Create a regular octagon using the repeat command to simplify your code. How has the angle measurement changed as the number of sides of the polygon increased?

  • Create a circle using the repeat command.

To draw a circle using MW:
  • repeat 360[FD 1 rt 1]

Part 3: Exploring MW Procedures

MW allows you to create a procedure to execute multiple commands as a single command. Each MW procedure begins with to and is followed by the name you assign to the procedure. As to begins each procedure, end closes each procedure (see example below).

To enter and run procedures in MW:
  • Choose the Pages pull down menu and click on Procedures.
  • Enter your code on the procedures page. For example, the following code will create a square of side length 50 turtle steps.

    to square
    repeat 4[FD 50 rt 90]
    end

  • Return to page1 by pulling down the Pages menu and clicking on page1.
  • To run the procedure above, type the procedure name (in this case square) in the command center and strike Enter.
    • Create and run the square procedure above. Next create a MW procedure that will create a square with sides of 100 turtle steps and run your code. How do the areas and perimeters of each square compare?

    You just constructed two square procedures with different values for the length of the sides. Instead of re-coding each time, variables can be used in a procedure so that different values can be substituted into the code.

    To include a variable in a procedure:

    In this example the colon : denotes the variable named steps.

    To square :steps
    repeat 4 [FD :steps rt 90]
    end


    As before this procedure would be entered on the procedure page, then executed through the command center on the front page by typing both the procedure name and the value for the variable steps (e.g., square 50).

    • Create a logo procedure to draw an equilateral triangle and run your code.

    • Create a logo procedure to draw a regular hexagon and run your code.

    • Discuss the writing of individual procedures for regular polygons. Can you think of a way to use variables to create a more general procedure?

    Part 4: Two variable code for a regular polygon

    • To this point you have created several polygons using separate procedures. Use two variables to create a more general procedure. Hint: Use the side length and the number of sides of the regular polygon as your variables.

    Writing a procedure with two variables:

    This procedure uses two variables, steps and sides. Steps refers to the length of the side of a regular polygon and sides refers to the number of sides of the polygon.

    To polygon :steps :sides
    repeat :sides[FD :step rt 360 / :sides]
    end


    This procedure would be entered on the procedure page, then executed through the command center on the front page by typing both the procedure name and the values for the variables steps and sides with a single space between the values(e.g., polygon 50 4).

    • Generalize your methods to create a procedure that generates a regular polygon based on side length and exterior angle measure.

    This procedure uses the variables, steps and angle.

    To polygon :steps :angle
    repeat 360 / :angle [FD :steps rt :angle]
    end


    Part 5: Run a Procedure with Buttons and Sliders

    MW allows buttons to be used to execute procedures and sliders to control variable values. For instance your previous procedure polygon can be made more user-friendly by creating a button that instructs MW to create a polygon and creating sliders, named steps and angle to control the values of these variables.

    • Create a button labeled polygon and sliders labeled steps and angle. Choose appropriate ranges for the sliders. Use the sliders to choose values for steps and angle and draw a variety of polygons using the polygon button.

    To Insert a Button and Slider:
    • On the front page, page1, click on the left-hand side icon resembling a finger and move your pointer into the turtle space. A hand symbol will appear on the screen. Click the left mouse button. Label your button. Once this button is labeled it may be dragged to any screen location you desire by a right click and hold drag.
    • Follow a similar procedure for your slider. Name the slider the variable name in your procedure. Change the range of values for the slider appropriately to your procedure.
    • If you have created a variety of procedures you may use the same slider for all the buttons you have created or you may create a new slider for each button.

    Extensions:

    • Create a MW procedure that draws your first initial and allows your initial to be scaled.

    • Create a MW procedure that draws a non-equilateral isosceles triangle.

    • Create a MW procedure that draws a rectangle of dimensions m x n where m is not equal




    Back to Project Activities | Back to Math Homepage

    Send questions or comments here.
    Last modified on August 15, 2001.