December 09, 2025

Week 15 - Lines and loops practice

 CLASS OBJECTIVE

Practice the loop and  draw_line call using the graph window in Raptor, by creating a given image, using lines and loops.


CLASS ACTIVITIES


FIRST ALGORITHM
Now, you'll have to create an algorithm, using lines and loops, to draw a grid like the one in the image.

  • To draw the vertical lines you have to increase the X value, by 10.
  • To draw the horizontal lines, you have to increase the Y value, by 10.


Here's a unfinished example, you'll have to complete the algorithm. Create a new Raptor file and name it  STUDENT NUMBER + GRID 





SECOND ALGORITHM
After you create the grid, now you'll use lines and loops once again to create the next product in the graph window.
You'll have to understand that while the X value increases, the Y value decreases, in both cases.




Here's a unfinished example, you'll have to complete the algorith. Create a second Raptor file and name it  STUDENT NUMBER + DIAGONALS







THIRD ALGORITHM

All by your self, create a Chess board (8x8) in a 400x400 pixels window, using today's first algorithm as an example.

Figure out how to fill the squares using loops. (It's not an easy task). Create a new Raptor file and name it  STUDENT NUMBER + CHESSBOARD







CLASS NOTES

Write down in your notebook the title of the class, the objective and follow the instructions.

  • Draw the first flowchart.
  • Explain the loop structure and the draw_line coordinates.