December 07, 2024

Week 17-18 - Lines and coordinates 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.


INTRODUCTION

Today, you'll create two different products, the first with some assistance and the second completely alone.

In the first program you'll have to use a new Call:      

draw_line(x1,y1,x2,y2,color)

  • x1,y1 are the coordinates for the starting point of the line
  • x2,y2  are the coordinate for the ending point of the line

For example, in a 500x500 graph windows we can use the draw_line Call like this:
draw_line(100,50,450,350,blue)
and the result should look like:




INSTRUCTIONS

First program
Now, you'll have to create a program, 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.



Second progam
After you create the grid, now you'll use lines and loops once again to create the next product in the graph window.
Obvioulsy you'll need two variables because while the X value increases, the Y value decreases.




CLASS NOTES

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

  • Draw the final flow charts, shown in both Raptor programs.
  • Explain the loops structures and the draw_line coordinates.

December 02, 2024

Week 15 - Loop and graph window practice in Raptor

 CLASS OBJETIVE

Practice the loop programming structure using the graph window in Raptor, by creating a given image, using circles and loops.


ACTIVITY INSTRUCTIONS

As you've heard, the idea is that you con create your own programs to solve problems with out your teacher's help. Today, you'll have to create a program with a minimum of instructions. You'll use the graph window Calls, besides a loop, but you'll have to use previous knowledge to do it. 

Create the new program in Raptor and name it  Student number + Shield. Use the next image to know the final outcome.
  1. The graph window size must be exactly 500 horizontal and 500 vertical pixels.
  2. This is sequential program but you can try to use a loop to create the circles.
    • You'll need to use a variable to set the radius of the first circle to 250 pixels. Each subsequent circle should be 50 pixels smaller, continuing until the end.
    • Draw filled circles from outside in, alternating between light red and white.
  3. After the circles, draw the 5 lines using the next coordinates
    • (250,350)
    • (345,285)
    • (310,170)
    • (190,170)
    • (155,285)
  4. Use flood_fill to color blue. You'll have to find out the needed coordinates.

Once you finish the algorithm, turn it in using the Classroom post.




CLASS NOTES

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

  • Draw the final flow chart, shown in Raptor
  • Explain what does every step of the flow chart do, from the start symbol to the end symbol.