Turing Trains i Logo Wang Tiles Maze Arrays

# Wang Tiles

 edge and corner matched tilesets menu

## 3-edge Wang Tiles

A Wang tile with 3 different types of edge has 3^4 or 81 different tiles in a tileset. This is quite a lot and so is not often used to just produce a maze.

Here is the complete 3-edge Wang tileset.

 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
 68 69 70 71 72 73 74 75 76 77 78 79 80

### Tile Index

The following method creates a unique value for each tile:
Ignore blue edges. Add up yellow and green edges with the following tertiary weighting:

 Yellow North edge = 1 Yellow East edge = 3 Yellow South edge = 9 Yellow West edge = 27 Green North edge = 2 Green East edge = 6 Green South edge = 18 Green West edge = 54
Blue edges are ignored.

 North 1 or 2 West 27 or 54 East 3 or 6 South 9 or 18

This tile has 'Yellow North' + 'Green West', or 1 + 54, giving an index of '55'.

### Tileset Layout

Here are 2 possible 9x9 layouts of the complete Wang 3-edge tileset. In a packing layout each tile is used once only.

### Recursive (fractal) Layout

Here is a possible 9x9 layout of the complete Wang 3-edge tileset which is recursive as it can be extended in a similar manner to include higher tile orders.

You can see the order 2 tileset in the lower left quadrant.

See 4-order for a 4-edge layout.

### Symmetrical Layout

Here is a possible 9x9 layout of the complete Wang 3-edge tileset which is symmetrical about the xy axis and can be extended in a similar manner to include any tile order. You can see the order 2 tileset in the lower left quadrant.

The bottom row and left column of tiles are repeated throughout the array. Just add up the index values. So the top right tile is 54+18 = 72.

See Stage for random tile arrays.

Stage: Wang 3-edge Tiles

### Tile Rotation Symmetry

By removing rotations, we can also show the 3-edge Wang tileset like this:

 0 40 80 10 30 20 60 50 70 1 3 9 27 2 6 18 54 39 37 31 13 41 43 49 67 78 74 62 26 79 77 71 53 4 12 36 28 8 24 72 56 44 52 76 68 5 15 45 55 7 21 63 29 38 34 22 66 42 46 58 14 73 59 17 51 75 65 35 25 16 48 64 32 23 69 47 61 33 19 57 11

Where the numbers below each tile denote a rotation of 90° clockwise. Wang tiles are never rotated but this is a compact way of showing the complete tileset. It is also useful when producing tiles in Photoshop as you can rotate and save images.
For more bitwise maths see 'Flip' and 'Rotate' in the Glossary.
We can create a tile matching puzzle game from a set of these tiles. See Puzzles.

### 3-edge 'Flow' Tiles

Another way of depicting 3 edges is to use 'flow' or 'directional' paths. Paths can only flow one way across an edge, either into or out of the tile.

 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
 68 69 70 71 72 73 74 75 76 77 78 79 80

We still have three different types of edge; blue, yellow and green.

1/ Blue edges have no path.
2/ Yellow edges have a path which flows South or West, (towards the origin).
3/ Green edges have a path which flows North or East, (away from the origin).

Note that we can no longer flip or rotate the tile index value mathematically, as the path direction may need to change. So a yellow edge may need to change into a green edge etc on rotation.

We can use this tileset to create the following 'flow' maze.
See Stage for random flow tile arrays.

Stage: Flow Tiles (3-edge)

### Reduced Flow Tileset

For a perfect tree maze, we can reduce the number of tiles by only using tiles which have one and only one path flowing into the tile. This produces a set of 34 tiles, and here they are, with each tiles possible rotations.

 0 1 3 18 54 5 24 63 28 7 12 45 56 10 30 20 60 16 39 47 62 26 69 37 32 14 51 65 34 41 53 71 43 44

Tile-0 may not be needed. Tile-44 is used as a special start tile at the center of the tree maze. See Flow tiles.

### Reduced (sub) Tilesets

If the tiles are limited to just 2 colors then there are 3 posssible reduced tilesets of 16 tiles. The following table shows a Blue and Yellow, Yellow and Green and a Blue and Green tileset.

 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
 0 1 3 4 9 10 12 13 27 28 30 31 36 37 39 40
 40 41 43 44 49 50 52 53 67 68 70 71 76 77 79 80
 0 2 6 8 18 20 24 26 54 56 60 62 72 74 78 80

Renaming the tiles from 0 to 15 and placing in the usual 2-edge layout produces the following three tilesets.

Yellow and Green tileset has an index of +40 Blue and Yellow.
Blue and Green has an index of twice Blue and Yellow.

The remaining 33 tiles all contain a mixture of all 3 terrain levels.

See Twin Tiles for maze creation with 34 tiles from the above 3-edge tileset.

Stage: Celtic 3-edge

 Wang Tiles | cr31.co.uk | 2019