Page 100 - PlugGPT_V2.0_C5_Flipbook
P. 100

Clickipedia



                    A loop is a process which instructs a computer to repeat a set of commands,
                    a specified number of times.


                      DRAWING A POLYGON


                  A regular polygon is a closed figure with all sides of equal length and all angles
                  of equal size. In a regular polygon, the number of sides is equal to the number of
                  angles. Some regular polygons are shown below.








                    Equilateral Triangle            Square                  Pentagon                 Hexagon
                          (3 sides)                (4 sides)                (5 sides)                (6 sides)











                         Heptagon                  Octagon                  Nonagon                  Decagon
                          (7 sides)                (8 sides)                (9 sides)                (10 sides)

                  Drawing Regular Polygons using REPEAT Command

                  It is very easy to draw regular polygons using the REPEAT command. When the
                  sprite draws a polygon, it has to walk along the sides of the polygon, turning at a
                  specified angle at each turn, finally turning 360° before coming back. This walking
                  and turning back of the sprite can be called the total sprite trip.

                  The degree of turn is equal to 360° divided by the number of sides. For example to
                  draw a square, the turtle has to turn 4 times (a square has 4 sides), and each turn is
                  360º/4, that is 90°. To draw a triangle, the degree of turn will be 360°/3 = 120° and
                  to draw a hexagon the degree of turn will be 360°/6 = 60°.
                  To draw polygons, follow these steps:

                                          repeat  10
                  Step 1     Drag the                   block from Control blocks menu.


                  Step 2     Drag  the  move     10 steps  block,  turn       15 degrees   block and  wait     1 secs

                             block one by one and attach inside the Repeat block.
                  Step 3     Change the Repeat value and Turn value accordingly.



               98       Premium Edition-V
   95   96   97   98   99   100   101   102   103   104   105