Sometimes repeating patters can cause our eyes to see things that aren't there. Look at the picture below. Can you see little grey squares in the intersections of the white lines? Write a GraphicsProgram that create the optical illusion:


You may notice that the starter code for this project has the lines:

private static final int SIZE = 100;
private static final int GAP = 10;
which are written outside the run method (much like th random number generator). These lines define constants: variables whose values never change and since they are defined outside a method you can read their value from any point in the program. Though you could write this optical illusion using the numbers 100 and 10 directly in, using constants makes your program much easier to read.

Double For Loop

This problem requires using a for loop inside a for loop. Remember to use a different iterator variable for the inner loop. For example if your outer loop is of the form

for(int i = 0; i < 100; i++)
The loop in the body must iterate through a variable other than i.


If you have time, try creating this optical illusion! Note that all the squares are the same size and all lines are horizontal! Think about how to decompose your solution.

If you are stuck, try drawing each row with the first black square always starting at x = 0. Then try to figure out how to create the offset pattern.