CREATING SHAPES USING SQUARES by HC121104195430

VIEWS: 0 PAGES: 2

									Logo-Lab 3 (Dynamic Drawings)                         (25 pts)                                                  Page 1

CREATE A DRAWING THAT CAN CHANGE SIZE
In order to create a drawing that can change size (dynamic), you need to use a global variable. This type of variable gets
added to the main drawing procedure and it can then be used in all of your other procedures.

EXAMPLE TO TRY IN LOGO – Save the code as lab3-ex1
PROBLEM                                               to drawing :numSquares :size
Draw a set of squares the same size side by side.         cs          5        30
Use 2 global variables (number of squares and size)       rt 90
Start by facing turtle in direction to draw.              repeat :numSquares[square         moveToNextSquare]
                                                      end
Run program differently each time:
                                                      to square
drawing 5 30     (5 squares size 30)                      repeat 4[fd :size rt 90]
                                                      end

                                                      to moveToNextSquare
                                                          pu fd :size pd
drawing 10 20    (10 squares size 20)                 end




DYNAMIC DRAWINGS: You will create each drawing with a size variable. When done with drawing, run it
more than one time with different sizes each time to be sure drawing changes size.
1. DRAWING 1                                                     Algorithm
File: lab3-d1.lgo Main procedure: drawing                        1. Draw square 1 (the smallest one first)
Create 5 squares. Each square you draw should grow 10 more       2.
in size than the prior square. Add a size variable to the
drawing procedure for the size of the 1st square.

                                 to drawing :size
                                    square ____
                                    square ____ +___
                                    etc…

CHALLENGE: Create a variable for the Grow Amount.
(add this to the drawing procedure)
2. DRAWING 2                                                     Algorithm
File: lab3-d2.lgo Main procedure: drawing                        1. Move to Start (Top Left Corner of Screen)
Draw 10 squares descending like                                  2.
stair steps. Start each new square
½ way down from prior square
and fill each square with
alternating colors. Add a size
variable to drawing procedure
that lets you create the drawing with different square sizes.
Start your drawing near top left corner of screen so it can
expand down the screen properly.

CHALLENGE: Create a variable that lets you draw as
many squares as you want. (add this to drawing procedure)
Logo-Lab 3 (Dynamic Drawings)                         (25 pts)                                             Page 2

3. DRAWING 3                                                       Algorithm
File: lab3-d3.lgo Main procedure: drawing
Draw a big square with little squares at each corner. Add a
size variable to the drawing procedure to represent the size of
the big square. Make the size of the little squares 20 % of the
size of the Big Square. (ie: 20% of 50 = .20 x 50)
                             Two different ways to solve:
                             1. Repeat [Draw 1 side of big
                                square, draw small square]

                             2. Draw entire Big Square,
                                   move to each corner and
                                   draw small square.
4. DRAWING 4                                                       Algorithm
File: lab3-d4.lgo Main procedure: drawing
Draw the diamond shape below using squares. Add a size
variable to the drawing procedure that lets you create the
drawing with different square sizes.
                4
           3        3
      2                  2
  1                            1

                                        The idea I am giving you
                                        means draw each column
                                        1 at a time (starting
                                        turtle at bottom of
to drawing :size                        column) and when you
   drawColumn1                          get to the other side of
                                        the drawing you can
   moveToColumn2
                                        reuse code you wrote.
   drawColumn2
end

5. DRAWING 5                                                       Algorithm
File: lab3-d5.lgo Main procedure: drawing                          1. Move To Start (bottom left corner)
Draw the Smiley Face below using squares. Choose your own          2.
fill colors. Add a size variable to drawing for size of squares.
Draw 1 column at a time. Helpful procedures:
1) drawSquares :numSquares :fcolor
   draw a number of squares filled in with a given color
2) moveToNextCol – move back down and over 1 col



                                            NOTE
                                            To allow the
                                            drawing to
                                            expand, it will be
                                            best to start in
                                            bottom left corner
                                            of screen

								
To top