Quantcast
Channel: Active questions tagged tiling - Code Golf Stack Exchange
Viewing all articles
Browse latest Browse all 35

The number of tilings of a grid

$
0
0

Setup:A block is any rectangular array of squares, specified by its dimensions \$(w,h)\$. A grid is any finite ordered list of blocks. For example, \$\lambda = ((3,2),(3,1),(1,2))\$ defines a grid.

Let \$\lambda\$ and \$\mu\$ be two grids with equal area.

A tiling of \$\lambda\$ by \$\mu\$ is any rearrangement of the squares of \$\mu\$ into the shape of \$\lambda\$ satisfying two properties:

  1. horizontally adjacent squares of \$\mu\$ remain horizontally adjacent in \$\lambda\$, and
  2. vertically adjacent squares of \$\lambda\$ come from vertically adjacent squares of \$\mu\$.

In other words, while rearranging one is allowed to make horizontal cuts to the blocks of \$\mu\$ but not vertical cuts, and one is allowed to place blocks into \$\lambda\$ side-by-side, but not on top of one another.

Two tilings of \$\lambda\$ by \$\mu\$ are considered equivalent if they can be rearranged into one another by any combination of either permuting squares within a column or reordering the columns of a block.

Problem: Write a function \$T(\mu,\lambda)\$ which computes the number of inequivalent tilings of a grid \$\lambda\$ by another grid \$\mu\$ of equal area.

Specifications: You may use any data type you would like to specify a grid.

Examples:

  1. The grid \$\lambda=((1,2),(1,2),(1,1),(2,1))\$ admits a tiling by \$\mu=((1,3),(1,2),(2,1))\$ given by

enter image description here

There is exactly one other inequivalent tiling given by

enter image description here

(Since the two differently colored columns of height \$2\$ are not part of the same block, they cannot be permuted.)

  1. The three displayed tilings of \$\lambda=((3,1))\$ by \$\mu=((1,2),(1,1))\$ are equivalent:

enter image description here

  1. Let \$\lambda\$ be an arbitrary grid of area \$n\$ and let \$\lambda[(w,h)]\$ denote the number of blocks of \$\lambda\$ of dimension \$w \times h\$. Then \$T(\lambda,\lambda) = \prod_{w,h\geq 1} \lambda[(w,h)]!\$ and \$T(\lambda,((n,1))) = 1\$.

  2. The matrix of values of \$T(\mu,\lambda)\$ for all pairs of grids of area \$3\$ (row is \$\mu\$, column is \$\lambda\$):

((1,3))((1,2),(1,1))((1,1),(1,1),(1,1))((2,1),(1,1))((3,1))
((1,3))11111
((1,2),(1,1))01321
((1,1),(1,1),(1,1))00631
((2,1),(1,1))00011
((3,1))00001

Viewing all articles
Browse latest Browse all 35

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>