tetris tiling - on-line encyclopedia of integer sequences · tetris r tiling steve butler1, jason...

1
TETRIS R Tiling Steve Butler 1 , Jason Ekstrand 1 and Steven Osborne 1 Iowa State University, Ames, IA History I The number of ways to tile a 1 × n grid with monomoes (1 × 1 pieces) and dominos (1 × 2 pieces) is F n+1 and the number of ways to tile a 2 × n grid with dominoes is F n+1 where F n is the n th Fibonacci number [Bringham et al. 1996]. I Tiling GP n (an m × n grid is P m P n ) and GC n with a combination of monomoes, dominoes and squares (2 × 2 pieces) was counted in [Butler & Osborne 2012]. I The number of ways to tile a 2 × n, 3 × n and 4 × n grid with squares and L shaped tiles covering an area of three square units has also been counted [Chinn et al. 2007]. I Consider the number of ways to tile a grid with pieces which cover four square units. This leads us to TETRIS R , a popular video game that was developed in 1984. The gameplay involves placing a collection of 5 pieces covering four square units each (tetrominos) into a 10 × 20 grid. B asic Method Count the tilings by first relating the construction of a tiling to a walk in an auxiliary graph. Since walks in a graph can be counted by taking powers of the graph’s adjacency matrix, we can then count such tilings by reading off entries in some appropriate matrix to a power. Example (Domino Tiling) 1. Consider a domino tiling of a m × n grid. Slice the board vertically in between grid points. There will be some dominoes spanning the slice and others adjacent to the slice. Associate a 0, 1-array called the crossing with this slice. Working from the bottom of the grid to the top, if a domino crosses the slice put a 1 in the crossing, if it is adjacent to the slice put a 0 in the crossing. Figure: 3 × 6 grid tiled with dominoes Cyan crossing: [0, 0, 0] Purple crossing: [0, 0, 1] 2. We can consider all the possible ways to slice a m × n domino tiling by generating all 0, 1-arrays of length m. 3. Consider the directed multigraph graph with crossings as vertices. There is an edge between crossing i and crossing j if i and j can appear consecutively in a domino tiling. The number of the edges is determined by the number of ways i and j may appear. Consider the adjacency matrix A associated with this graph. 0 0 1 1 1 0 0 1 0 0 1 1 1 0 0 1 A = (0, 0) (1, 1) (1, 0) (0, 1) 1100 1000 0001 0010 Figure: Crossings for 2 × n grid tiled with dominoes 4. The number of ways to tile an m × n board is the number of walks of length n beginning and ending at the vertex which has no spanning dominoes. Thus the number of such tilings is (A n ) 00 . Example : A 6 = 13 8 0 0 8500 0010 0001 The Algorithm 1. Generate every rotation/reflection of tetrominos. Determine number of ways each tetromino may cross a vertical slice in the grid. 2. Form a list of all possible crossings of length m. 3. For each crossing i, build a list of possible neighbors of i. 4. Build a sparse matrix A with the first row corresponding to the null crossing and A ij = 1 if ij is a possible crossing pair. 5. The number of ways to tile an m × n grid with tetrominos is (A n ) 00 . Example of Tetromino Tiling D ata 4 × m grid 6 × m grid 8 × m grid 10 × m grid * m tilings 1 1 2 4 3 23 4 117 5 454 6 2003 7 9157 8 40899 9 179399 10 796558 11 3546996 12 15747348 13 69834517 14 310058192 15 1376868145 16 6112247118 17 27132236455 18 120453362938 19 534754586459 20 2373975139658 m tilings 1 0 2 9 3 0 4 2003 5 0 6 178939 7 0 8 22483347 9 0 10 2569437089 11 0 12 304446920314 13 0 14 35704534261665 15 0 16 4203065267122878 17 0 18 494232382069456694 19 0 20 58138539945306221167 m tilings 1 1 2 25 3 997 4 40899 5 800290 6 22483347 7 657253434 8 19077209438 9 517312744806 10 14571957312254 11 412240433359025 12 11632857444709188 13 326275845576101452 14 9187549952207915190 15 258821654387452112268 16 7288072624408347082481 17 205113474464891986564786 18 5775045306250163285744264 19 162604515634027972949999862 20 4578081985029201186301230265 m tilings 1 0 2 64 3 0 4 796558 5 0 6 2569437089 7 0 8 14571957312254 9 0 10 72713560548906621 11 0 12 384821695402098361211 13 0 14 2010131712836219582393758 15 0 16 10562717745357186307808646827 17 0 18 55429948254413509959115263015669 19 0 20 291053238120184913211835376456587574 * Data generated on a machine with a 24-core 2.53 GHz Intel Xeon processor and 48 GiB of ram. It took 49 CPU hours and 44.7 GiB of memory. Tetrominos Domino Tiling Statistics This method of counting tilings may also be extended to count certain statistics about tilings. For example, given a domino tiling of a grid we may wish to count how many vertical tiles were used. Or rather, given the set of domino tilings of an m × n grid we can compute the expected number of vertical tiles in a random tiling. We do this in the following way: instead of A ij = 1 if crossings i and j are adjacent, let A ij = x k where k is the number of vertical tiles in between crossings i and j. For example, in the 2 × n case, A = (0, 0) (1, 1) (1, 0) (0, 1) x 100 1000 0001 0010 Now, if we look at the polynomial (A n ) 00 , the coefficient of x corresponds to the number of tilings with vertical dominoes. In the 2 × n case, (A 6 ) 00 = x 6 + 5x 4 + 6x 2 + 1. Thus, there is 1 tiling with 6 vertical dominoes, 5 tilings with 4 vertical dominoes, etc. From this polynomial, we may compute the expected number of vertical tiles in a random tiling. Below is a sampling of such computations. Example grid expected proportion of vertical tiles m 2 6 12 16 m × 1 1.0000 1.0000 1.0000 1.0000 m × 2 0.5000 0.5128 0.5322 0.5373 m × 3 0.5556 0.5881 0.6015 0.6049 m × 4 0.5000 0.5059 0.5196 0.5241 m × 5 0.5000 0.5282 0.5435 0.5474 m × 6 0.4872 0.5000 0.5108 0.5149 m × 7 0.4830 0.5074 0.5226 0.5267 m × 8 0.4779 0.4956 0.5057 0.5093 m × 9 0.4747 0.4976 0.5122 0.5163 m × 10 0.4719 0.4920 0.5023 0.5057 m × 11 0.4697 0.4921 0.5060 0.5101 m × 12 0.4678 0.4892 0.5000 0.5032 m × 13 0.4662 0.4886 0.5020 0.5061 m × 14 0.4649 0.4869 0.4982 0.5014 m × 15 0.4637 0.4862 0.4993 0.5033 m × 16 0.4627 0.4851 0.4968 0.5000 References R. C. Brigham, R. M. Caron, P. Z. Chinn and R. P. Grimaldi. A tiling scheme for the Fibonacci numbers. J. Recreational Math., 28 (1996) 10-17. S. Butler, P. Horn and E. Tressler, Intersecting domino tilings, The Fibonacci Quarterly 48 (2010), 114-120. S. Butler and S. Osborne, Counting tilings by taking walks, to appear in Journal of Combinatorial Mathematics and Combinatorial Computing. P. Chinn, R. Grimaldi and S. Heubach. Tiling with L’s and squares, Journal of Integer Sequences 10 (2007), article 07.2.8, 17 pp. 1 Department of Mathematics, Iowa State University, Ames, IA 50011 ([email protected], [email protected], [email protected])

Upload: others

Post on 04-Sep-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: TETRIS Tiling - On-Line Encyclopedia of Integer Sequences · TETRIS R Tiling Steve Butler1, Jason Ekstrand1 and Steven Osborne1 Iowa State University, Ames, IA History IThe number

TETRIS R© TilingSteve Butler1, Jason Ekstrand1 and Steven Osborne1

Iowa State University, Ames, IA

History

I The number of ways to tile a 1 × n grid with monomoes (1 × 1 pieces) and dominos(1 × 2 pieces) is Fn+1 and the number of ways to tile a 2 × n grid with dominoes isFn+1 where Fn is the nth Fibonacci number [Bringham et al. 1996].I Tiling G�Pn (an m × n grid is Pm�Pn) and G�Cn with a combination of monomoes,dominoes and squares (2 × 2 pieces) was counted in [Butler & Osborne 2012].I The number of ways to tile a 2 × n, 3 × n and 4 × n grid with squares and L shapedtiles covering an area of three square units has also been counted[Chinn et al. 2007].IConsider the number of ways to tile a grid with pieces which cover four square units.This leads us to TETRIS R©, a popular video game that was developed in 1984. Thegameplay involves placing a collection of 5 pieces covering four square units each(tetrominos) into a 10 × 20 grid.

Basic Method

Count the tilings by first relating the construction of a tiling to a walk in anauxiliary graph. Since walks in a graph can be counted by taking powers ofthe graph’s adjacency matrix, we can then count such tilings by reading offentries in some appropriate matrix to a power.Example (Domino Tiling)

1. Consider a domino tiling of a m × n grid. Slice the board vertically in between gridpoints. There will be some dominoes spanning the slice and others adjacent to theslice. Associate a 0, 1-array called the crossing with this slice. Working from thebottom of the grid to the top, if a domino crosses the slice put a 1 in the crossing, ifit is adjacent to the slice put a 0 in the crossing.

Figure: 3 × 6 grid tiled with dominoes

Cyan crossing: [0, 0, 0]Purple crossing: [0, 0, 1]

2. We can consider all the possible ways to slice a m × n domino tiling by generatingall 0, 1-arrays of length m.

3. Consider the directed multigraph graph with crossings as vertices. There is anedge between crossing i and crossing j if i and j can appear consecutively in adomino tiling. The number of the edges is determined by the number of ways i andj may appear. Consider the adjacency matrix A associated with this graph.

00

11

10

01

00

11

10

01

A =

(0, 0)(1, 1)(1, 0)(0, 1)

1 1 0 01 0 0 00 0 0 10 0 1 0

Figure: Crossings for 2 × n grid tiled with dominoes

4. The number of ways to tile an m × n board is the number of walks of length nbeginning and ending at the vertex which has no spanning dominoes. Thus thenumber of such tilings is (An)00.

Example : A6 =

13 8 0 08 5 0 00 0 1 00 0 0 1

The Algorithm1. Generate every rotation/reflection of tetrominos. Determine number of ways each tetromino may

cross a vertical slice in the grid.2. Form a list of all possible crossings of length m.3. For each crossing i, build a list of possible neighbors of i.4. Build a sparse matrix A with the first row corresponding to the null crossing and Aij = 1 if ij is a

possible crossing pair.5. The number of ways to tile an m × n grid with tetrominos is (An)00.

Example of Tetromino Tiling

Data4 × m grid 6 × m grid 8 × m grid 10 × m grid∗

m tilings1 12 43 234 1175 4546 20037 91578 408999 17939910 79655811 354699612 1574734813 6983451714 31005819215 137686814516 611224711817 2713223645518 12045336293819 53475458645920 2373975139658

m tilings1 02 93 04 20035 06 1789397 08 224833479 010 256943708911 012 30444692031413 014 3570453426166515 016 420306526712287817 018 49423238206945669419 020 58138539945306221167

m tilings1 12 253 9974 408995 8002906 224833477 6572534348 190772094389 51731274480610 1457195731225411 41224043335902512 1163285744470918813 32627584557610145214 918754995220791519015 25882165438745211226816 728807262440834708248117 20511347446489198656478618 577504530625016328574426419 16260451563402797294999986220 4578081985029201186301230265

m tilings1 02 643 04 7965585 06 25694370897 08 145719573122549 010 7271356054890662111 012 38482169540209836121113 014 201013171283621958239375815 016 1056271774535718630780864682717 018 5542994825441350995911526301566919 020 291053238120184913211835376456587574

∗Data generated on a machine with a 24-core 2.53 GHz Intel Xeon processor and 48 GiB of ram. It took 49 CPU hours and 44.7 GiB of memory.

Tetrominos

Domino Tiling StatisticsThis method of counting tilings may also be extended tocount certain statistics about tilings. For example, given adomino tiling of a grid we may wish to count how manyvertical tiles were used. Or rather, given the set of dominotilings of an m × n grid we can compute the expected numberof vertical tiles in a random tiling.

We do this in the following way: instead of Aij = 1 ifcrossings i and j are adjacent, let Aij = xk where k is thenumber of vertical tiles in between crossings i and j. Forexample, in the 2 × n case,

A =

(0, 0)(1, 1)(1, 0)(0, 1)

x 1 0 01 0 0 00 0 0 10 0 1 0

Now, if we look at the polynomial (An)00, the coefficient of x`

corresponds to the number of tilings with ` vertical dominoes.In the 2 × n case, (A6)00 = x6 + 5x4 + 6x2 + 1. Thus, there is1 tiling with 6 vertical dominoes, 5 tilings with 4 verticaldominoes, etc. From this polynomial, we may compute theexpected number of vertical tiles in a random tiling. Below isa sampling of such computations.Example

grid expected proportion of vertical tilesm 2 6 12 16m × 1 1.0000 1.0000 1.0000 1.0000m × 2 0.5000 0.5128 0.5322 0.5373m × 3 0.5556 0.5881 0.6015 0.6049m × 4 0.5000 0.5059 0.5196 0.5241m × 5 0.5000 0.5282 0.5435 0.5474m × 6 0.4872 0.5000 0.5108 0.5149m × 7 0.4830 0.5074 0.5226 0.5267m × 8 0.4779 0.4956 0.5057 0.5093m × 9 0.4747 0.4976 0.5122 0.5163m × 10 0.4719 0.4920 0.5023 0.5057m × 11 0.4697 0.4921 0.5060 0.5101m × 12 0.4678 0.4892 0.5000 0.5032m × 13 0.4662 0.4886 0.5020 0.5061m × 14 0.4649 0.4869 0.4982 0.5014m × 15 0.4637 0.4862 0.4993 0.5033m × 16 0.4627 0.4851 0.4968 0.5000

References

R. C. Brigham, R. M. Caron, P. Z. Chinn and R. P. Grimaldi.A tiling scheme for the Fibonacci numbers. J. RecreationalMath., 28 (1996) 10-17.

S. Butler, P. Horn and E. Tressler, Intersecting dominotilings, The Fibonacci Quarterly 48 (2010), 114-120.

S. Butler and S. Osborne, Counting tilings by taking walks,to appear in Journal of Combinatorial Mathematics andCombinatorial Computing.

P. Chinn, R. Grimaldi and S. Heubach. Tiling with L’s andsquares, Journal of Integer Sequences 10 (2007), article07.2.8, 17 pp.

1Department of Mathematics, Iowa State University, Ames, IA 50011 ([email protected], [email protected], [email protected])