Weave a Web

Tile the plane using this four tiles and
The resulting pattern looks like a web formed by threads with over- and undercrossings. However, you have to tile periodically. You choose a number n (between 3 and 12) and two smaller numbers a and b. Then you type the numbers 1,2,3, or 4 in the first n entries in the row below. Click on "weave" and see what happens. (Try n=3, a=1, b=2, and the numbers 1,3,2 to get a bunch of braids.)

So what happens? You can get an idea by clicking on "pattern" after you filled out the entries as described above. You will see blanks (denoting 0) and the number 1,2,3,...n-1 distributed in a periodic way over the plane. Now each blank is replaced by the tile whose number shows in the first entry of the row below the n,a,b definitions. Each number 1 is replaced by the tile whose number shows in the second entry. And so on. If we choose one blank, one "1", ... and one "n-1" and consider this to be a "supertile" (like shown in the upper left corner if you click "pattern"), the resulting picture could be viewed as being put together by many identical copies of this supertile

Then how is the pattern of blanks, 1s, ... (n-1)s generated? We give each place in the plane its integer x- and y-coordinates x and y. Then the number occuring at this place is ax+by (mod n). The pattern of the blanks is called a "lattice".

One could ask a lot of question of the resulting webs. How many different kind of threads do we have? Is the web stable (could you lie on a hammock using such a web). This would lead into the interesting topic of knot theory. Let me give you some numbers creating interesting webs:
Try 7,2,3; 1,2,4,1,2,3,2
Try 7,2,3; 1,2,4,1,3,1,2
Try 7,2,3; 2,4,3,1,3,1,2
Try 11,2,5; 1,2,3,1,4,1,2,3,2,3,1
but also 10,2,5; 4,3,1,4,4,1,4,4,2,1
braids: only one type of thread, but Each braid is connected, though parallel strings are not linked!
Two different types of thread:

What about the linking number of parallel threads? Look at 4,2,1; 1,2,3,4
number of threads 1 2 3 4
  5,2,1; 3,1,4,1,2 consecutive threads are linked! 4,2,1; 1,2,2,3, remarkable! 6, 2, 3: 1,2,3,2,4,1 4
    10,2,3; 1,2,3,4,2,1,3,1,4,2 12, 2, 3; 1,2,3,2,2,1,2,3,4,2,2,1  
not connected 3,2,1; 1,2,3      
      4