P1 Task 2 - Draw a Grid Of Rectangles

Note

When finished, submit the iRobot project code of your solution in Moodle

Make the robot draw a grid of rectangles (see the figure 2a-c). The dimension of the grid (rows and columns) must be changeable through variables (figure 2a), i.e., the code is able to draw grids of arbitrary dimensions like 2x2, 2x7, 5x3, etc (figure 2b and 2c). The rectangles must not overlap with eachother. You are free to choose your drawing technique, which may be more efficient than one shown in figure 2. If you’re stuck then the “nested loop” and “variables” exercises might provide you some guidance.

_images/task_grid_printer_a.gif

Figure. 2a: The number of columns and rows in the grid must be controllable via variables

_images/task_grid_printer_b.gif

Figure. 2b: A 5x2 grid

_images/task_grid_printer_c.gif

Figure. 2c: A 3x5 grid