Wolfram Research

Function Repository Resource:

GenerateTiling (1.0.0) current version: 2.0.0 »

Source Notebook

Generate a tiling from a set of rectangular array tiles

Contributed by: Wolfram Research

ResourceFunction["GenerateTiling"][tiles,{},size]

covers a size array with tiles.

ResourceFunction["GenerateTiling"][tiles,seed,size]

covers a size array with tiles and starting seed array.

ResourceFunction["GenerateTiling"][tiles,{},size,"Boundary" "Periodic"]

covers a size toroidal array with tiles.

Details and Options

A pattern is a rectangular array of positive integer values suitable for use in the resource function TilingPatternPlot.
A tile mask is a subset of positions within a rectangular array, such as the a values in {{a,a,a},{_,a,_}}. This particular mask is also known as the Tetris T shape.
A tile is an array that can contain integers or blanks.
All tiles in a tileset fit in an array of the same size, say {a,b}. If all subarrays of that size in a larger pattern matches a tile in the tileset, then that tileset can be used to make the given pattern.
An all-zero tile leads to an all white or all zero pattern .
An all-one tile leads to an all black or all one pattern .
The two tiles lead to a checkboard pattern . No subset of the tiles will make a larger pattern, so these two tiles produce a minimal tiling.
The tileset will produce the all-white pattern, but the second tile is not necessary. Therefore, this is not a minimal tileset.
The above patterns have a size of 4×4.
The input tiles should be an array of integer or Blank (_) values.
Consider and {{_,0,0},{0,1,_}}. These both represent a 4-cell tile within a 6-cell array, where the integers indicate the coloring of the tile and the Blank (_) values are wildcards.
A tiling with a periodic boundary can be divided into identical pieces. Basically, this gives a tiling on a torus that may be used for an infinite tiling.

Examples

Basic Examples (3) 

Generate a tiling for a set of tiles:

In[1]:=
tiles = {{{0, 1}, {1, 0}}, {{1, 0}, {1, 1}}, {{1, 1}, {0, 1}}};
tiling = ResourceFunction["GenerateTiling"][tiles, {}, 10]
Out[2]=

The tiles used:

In[3]:=
ResourceFunction["TilingPatternPlot"][#, ImageSize -> 50] &@tiles
Out[3]=

The generated tiling:

In[4]:=
ResourceFunction["TilingPatternPlot"][tiling, {Frame -> False, Mesh -> None, PixelConstrained -> 10}]
Out[4]=

Scope (2) 

Generate a tiling from a complicated set of tiles:

In[5]:=
tiles = {{{0, 1, 1}, {1, 1, 1}}, {{1, 0, 1}, {1, 1, 1}}, {{1, 1, 0}, {1, 1, 1}}, {{1, 1, 1}, {1, 0, 1}}, {{0, 1, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 1}}, {{0, 0, 0}, {0, 1, 0}}, {{0, 0, 0}, {1, 0, 0}}, {{1, 0, 1}, {0, 0, 0}}, {{1, 1, 1}, {0, 1, 0}}, {{0, 0, 1}, {0, 1, 1}}, {{0, 1, 0}, {1, 1, 0}}, {{1, 0, 0}, {1, 0, 1}}};
tiling = ResourceFunction["GenerateTiling"][tiles, {}, 30];

The tiles used:

In[6]:=
ResourceFunction["TilingPatternPlot"][#, ImageSize -> 50] &@tiles
Out[6]=

The generated tiling:

In[7]:=
ResourceFunction["TilingPatternPlot"][tiling, {Frame -> False, Mesh -> None, PixelConstrained -> 4}]
Out[7]=

Generate a tiling around a {{1,1}} initial condition:

In[8]:=
tiles = {{{0, 1}, {1, 0}}, {{1, 0}, {1, 1}}, {{1, 1}, {0, 1}}};
tiling = ResourceFunction["GenerateTiling"][tiles, {{1, 1}}, 6]
Out[9]=

A tiling around a {{0,0}} initial condition isn't possible for this set of tiles:

In[10]:=
tiles = {{{0, 1}, {1, 0}}, {{1, 0}, {1, 1}}, {{1, 1}, {0, 1}}};
tiling = ResourceFunction["GenerateTiling"][tiles, {{0, 0}}, 6]
Out[11]=

Options (3) 

Boundary (3) 

Generate a tiling on a size 30 torus (i.e. a tiling with a size 30 periodic boundary):

In[12]:=
tiles = {{{0, 1, 1}, {1, 1, 1}}, {{1, 0, 1}, {1, 1, 1}}, {{1, 1, 0}, {1, 1, 1}}, {{1, 1, 1}, {1, 0, 1}}, {{0, 1, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 0, 1}}, {{0, 0, 0}, {0, 1, 0}}, {{0, 0, 0}, {1, 0, 0}}, {{1, 0, 1}, {0, 0, 0}}, {{1, 1, 1}, {0, 1, 0}}, {{0, 0, 1}, {0, 1, 1}}, {{0, 1, 0}, {1, 1, 0}}, {{1, 0, 0}, {1, 0, 1}}}; 
ResourceFunction["TilingPatternPlot"][
 ResourceFunction["GenerateTiling"][tiles, {}, 30, "Boundary" -> "Periodic"], {Frame -> False, Mesh -> None, PixelConstrained -> 4}]
Out[12]=

The tiles cover a size 12 section, but the toroidal wrapping between the top and bottom edge does not correspond to the tile set:

In[13]:=
ResourceFunction["TilingPatternPlot"][
 ResourceFunction["GenerateTiling"][tiles, {}, 12], {Frame -> False, Mesh -> None, PixelConstrained -> 4}]
Out[13]=

These tiles cannot cover a size 12 torus:

In[14]:=
ResourceFunction["GenerateTiling"][tiles, {}, 12, "Boundary" -> "Periodic"]
Out[14]=

Neat Examples (3) 

Generate a tiling from a complicated set of tiles:

In[15]:=
tiles = {{{0, 0, _}, {0, _, 0}, {1, _, _}}, {{0, 0, _}, {0, _, 1}, {0, _, _}}, {{0, 0, _}, {1, _, 0}, {0, _, _}}, {{0, 0, _}, {1, _, 0}, {1, _, _}}, {{0, 1, _}, {0, _, 0}, {1, _, _}}, {{0, 1, _}, {0, _, 1}, {0, _, _}}, {{0, 1, _}, {1, _, 1}, {1, _, _}}, {{1, 0, _}, {0, _, 0}, {1, _, _}}, {{1, 0, _}, {1, _, 0}, {0, _, _}}, {{1, 0, _}, {1, _, 1}, {1, _, _}}, {{1, 1, _}, {0, _, 0}, {0, _, _}}, {{1, 1, _}, {0, _, 0}, {1, _, _}}, {{1, 1, _}, {1, _, 0}, {0, _, _}}, {{1, 1, _}, {1, _, 1}, {0, _, _}}};
tiling = ResourceFunction["GenerateTiling"][tiles, {}, 79, "Boundary" -> "Periodic"];

The tiles used:

In[16]:=
ResourceFunction["TilingPatternPlot"][#, ImageSize -> 50] &@tiles
Out[16]=

The generated tiling:

In[17]:=
ResourceFunction["TilingPatternPlot"][tiling, {Frame -> False, Mesh -> None, PixelConstrained -> 4}]
Out[17]=

Version History

  • 2.0.0 – 23 June 2022
  • 1.0.0 – 25 March 2022

Related Resources

Author Notes

A Details&Options needs to be removed.

License Information