Tuesday, July 29, 2014

Solutions: More Practice with Nested Loops in Pro-Bot

Here is a set of solutions to draw the given patterns using Nested Loops in Pro-Bot. Please keep in mind that this is just a subset of the possible solutions, there can be many depending on the start point and the direction in which Pro-Bot is facing.


1.  Assuming that you start the figure from the leftmost corner at the bottom, here is one way to write the program:


    Rpt 3 [
    Rpt 5 [
    Fd 6
    Rt
    ]
    Fd 6
    Lt
    ]




2.  Assuming that you start the figure from the leftmost corner, here is one way to write the program:

 
     Rpt 3 [
     Fd 6
     Lt
     Rpt 2 [
     Fd 6
     Rt
     ]
     Fd 6
     Lt
     ]


3.  Assuming that you start the figure from the leftmost corner, here is one way to write the program:

     Rpt 2 [
     Rpt 3 [
     Fd 6
     Rt
     ]
     Bk 6
     Rt
     ] 

No comments:

Post a Comment