How do I make this image using the "mod" block?

I am stuck on U2L4-page 1. I can't seem to figure out how to create these images:

1) You need first to calculate the square's width a = (width of the stage / 5)
  1. Start at (y = 0), (x = on the left edge)

  2. Change y by minus (a/2)

  3. Change x by a

  4. go up (and then left, and down); by a each time

  5. move into the outlined area and there use the 'fill block' to fill it with the violet color

  6. repeat step 2) and step 3)

  7. Change x by (a*2)

  8. repeat steps 5) and 6)

Using this knowledge draw all the squares and fill them with color.

Oh, I forgot, in the beginning, let's call it 'zero step', you need to fill the whole stage with yellow color.

Once you have completed drawing and filling all the violet squares, you will want to use a loop in order to make the white dots all over the place.

You can make them by going to a random position and, while pen is down, move 0 steps, this will make a (white) dot at the position.

The last picture can maybe made by going to the center, then you need to calculate directions for each of the violet rays, you do it by dividing 360 by the number of rays.

Point to direction 0 and turn by 360/9 and use a loop to change at the same time both position and size of the pen, so will get rays thicker as you go.

Once all the rays have been completed, do the white dots again.

I think you must not have read the exercise @SP is working on, which is here:


Then click on "Take It Further" at the bottom. But in order to understand those problems you first have to read this:

Hi! Welcome to the Snap! forum.

So if you look at the hint, it says to think about something like
((round ((x position)/20)) mod 2)
Mod 2, you'll recall, tells you whether a number is odd or even, so it looks like it'll be most directly relevant to something like part (b), which alternates something being odd or even. Try testing that expression being 0 and see what picture you get, and then figure out how to change that picture to be the picture you want.

If that doesn't help, come ask again -- but show us what you tried and what result you got.

Yeah, the original title didn't mention using MOD function until you changed it.

Now I can see that this BJC lesson is not so much about exploring Snap! (using just a little of math), but more about exploring math (by means of Snap!) :stuck_out_tongue_winking_eye:

p.s.
Don't take my teasing too seriously (me being a bit mischievous).

Not me!

1 Like

Who changed it then? the creator of this thread.