| Applet | Instructions | Algorithm | Examples |
The two numbers that generate these patterns can be changed using the scroll bars. The vertical bar sets the multiplier and the higher horizontal one the offset. The lower horizontal scroll bar determines how many cells are drawn in the pattern.
The Algorithm for an N x N square pattern looks like;
Set all cells to gray
for x = 0 to N-1
y = (x * multiplier + offset) % N
cell (x,y) = blue
cell (y, N - 1 - x) = blue
cell (N - 1 - x, N - 1 - y) = blue
cell (N - 1 - x, x) = blue
next
What! You want examples? Just try it.