Page 95 - TP_Play_V2.2_Class8
P. 95

Look at this example:
                Robby has to paint these blank boxes to make a letter ‘U’
                                                                          Start












                The program will be

                          Fill Colour                                      Fill Colour
                          Move 1 down                                      Repeat 3 times
                          Move 1 step and fill colour                      (Move 1 step and fill colour)
                          Move 1 step and fill colour
                          Turn left                                        Turn left
                          Move 1 step and fill colour                      Repeat 2 times
                          Move 1 step and fill colour                      (Move 1 step and fill colour)
                          Turn left
                          Move 1 step and fill colour                      Turn left
                          Move 1 step and fill colour                      Repeat 3 times
                          Move 1 step and fill colour                      (Move 1 step and fill colour)


                                Program without a loop                             Program with a loop


                Look at another examples:
                1.                                             Start
                     Repeat 2 times
                     {
                     Move 1 step down
                     }
                     Repeat 6 times
                     (
                     Fill color
                     Move 1 step left
                     )

                                                              Start
                2.




                     Repeat until reached last column
                     (
                     Fill color
                     Move 1 step left
                     )



                                                                                             #Algorithmic Intelligence  93
   90   91   92   93   94   95   96   97   98   99   100