# Two-State Alien Tiles: A Coding-Theoretical Perspective

^{1}

^{2}

^{3}

^{4}

^{5}

^{6}

^{*}

## Abstract

**:**

## 1. Introduction

**Hamming weight**. What is the minimal number of lit lights among all solvable games except the solved game?**Coset leader**. Which game has the minimal number of lit lights that the player can achieve from a given game? What is this minimal number? How many such games can the player achieve?**Covering radius**. Among all possible games, what is the maximal number of lit lights that remained when the number of lit lights is minimized?**Error correction**. Which is the “closest” solvable game from a given unsolvable game in the sense of toggling the minimal number of individual lights? Furthermore, is such closest solvable game unique?

## 2. General Techniques for Lights out and Its Two-State Variants

#### 2.1. Model

- A game board of lights;
- A set of toggle patterns for toggling certain lights.

**Definition**

**1**

- Applying a move twice will not toggle any lights, i.e., apply the same move again will undo the move;
- Every permutation of a sequence of moves toggles the same set of lights, i.e., the order of the moves is not taken into consideration.

#### 2.2. Linear Algebra Approach

**Definition**

**2**

**Problem:**Solvability Check and/or Finding a Solution for General Two-State Lights Out Variants;**Instance:**An $mn\times 1$ binary vector $g\in G$, and an $mn\times c$ binary matrix $\mathsf{\Psi}$, with $c\le mn$;**Question:**Is there a k that satisfies $\mathsf{\Psi}k=g$?**Objective:**Find a k that satisfies $\mathsf{\Psi}k=g$.

#### 2.3. Minimal Number of Moves (The Shortest Solution)

**Problem:**Shortest Solution Problem for General Two-State Lights Out Variants;**Instance:**A set B of $mn\times 1$ binary vectors in $ker\left(\psi \right)$, where $\left|B\right|=mn$ and the span of B is $ker\left(\psi \right)$, and an $mn\times 1$ binary vector $k\in K$;**Objective:**Find a vector $u\in ker\left(\psi \right)$ that can minimize ${\parallel k+u\parallel}_{1}$.

**Theorem**

**1.**

**Proof.**

## 3. Two-State Alien Tiles

**Definition**

**3**

#### 3.1. Easy Games and Doubly Easy Games

**Definition**

**4**

**Definition**

**5**

#### 3.2. Even-by-Even Games

#### 3.3. Even-by-Odd (and Odd-by-Even) Games

- The $(1,j)$-th light is toggled for $m+n-2$ times, where $m+n-2$ is odd.
- Each of the other lights in the j-th column is toggled for $m-1$ times, where $m-1$ is odd.
- Each of the other lights in the 1-st row is toggled for $n-1$ times, where $n-1$ is even.
- All other lights that are not in the j-th column and not in the i-th row are toggled twice.

**Theorem**

**2.**

**Proof.**

- $\tilde{r}\left(g\right)={\mathbf{0}}_{m-1,1}$ if and only if $g\in S$, because ${\mathbf{0}}_{m-1,1}$ is the syndrome of the solved game.
- The number of cosets in $G/S$, i.e., the index $[G:S]$, is ${2}^{m-1}$, due to the surjection of $\tilde{r}$.
- The number of solvable games, i.e., $\left|S\right|$, is $\left|G\right|/[G:S]={2}^{mn-m+1}$.
- A game is solvable if and only if the parities of all rows are the same. The complexity of verifying the solvability is thus $\mathcal{O}\left(mn\right)$.

#### 3.4. Odd-by-Odd Games

**Theorem**

**3.**

**Proof.**

**Theorem**

**4.**

**Proof.**

- $inv\left(g\right)=({\mathbf{0}}_{m-1,1},{\mathbf{0}}_{1,n-1})$ if and only if $g\in S$, because $({\mathbf{0}}_{m-1,1},{\mathbf{0}}_{1,n-1})$ is the syndrome of the solved game.
- The number of cosets in $G/S$, i.e., the index $[G:S]$, is ${2}^{m+n-2}$, due to the surjection of inv.
- The number of solvable games, i.e., $\left|S\right|$, is $\left|G\right|/[G:S]={2}^{mn-m-n+2}$.
- A game is solvable if and only if the parities of all rows and all columns are the same. The complexity of verifying its solvability is thus $\mathcal{O}\left(mn\right)$.

## 4. Coding-Theoretical Perspective of Two-State Alien Tiles

#### 4.1. Hamming Weight

**Even-by-Even Games**. These games are completely solvable, so a game with only one lit light has the minimal Hamming weight among all non-zero solvable games, i.e., the Hamming weight of such code is 1. This also means that even-by-even games have no error-detecting and correcting abilities.

**Even-by-Odd Games**. The syndrome of an even-by-odd solvable game is ${\mathbf{0}}_{m-1,1}$. There are two possible row parity vectors (of size $m\times 1$) that correspond to this syndrome, namely, ${\mathbf{0}}_{m,1}$ and ${\U0001d7d9}_{m,1}$.

**Odd-by-Odd Games**. The syndrome of an odd-by-odd solvable game is the pair $({\mathbf{0}}_{m-1,1},{\mathbf{0}}_{1,n-1})$. If $m=1$, only two games are in S, which are the all-zeros and the all-ones games. Therefore, the Hamming weight of the code is n. If $n=1$, similarly, the Hamming weight is m. Both cases hold at the same time when $m=n=1$.

#### 4.2. Coset Leader

**Even-by-Even Games**. As even-by-even games have no error-correcting ability, it is not an interesting problem to find out the coset leader. In fact, we have $G/S=\left\{S\right\}=\left\{G\right\}$, and thus the coset leader of the only coset is the solved game ${\mathbf{0}}_{mn,1}$, which contains no lit lights.

**Even-by-Odd Games**. We consider the syndrome $\tilde{r}\left(g\right)={({\tilde{r}}_{2},{\tilde{r}}_{3},\dots ,{\tilde{r}}_{m})}^{\u22ba}\in {\mathbb{F}}_{2}^{(m-1)\times 1}$ of a game g in a coset C. We have two possible row parity vectors, namely,

**Odd-by-Odd Games**. Consider the syndrome $inv\left(g\right)=(\tilde{r}\left(g\right),\tilde{c}\left(g\right))$. Write $\tilde{r}\left(g\right)={({\tilde{r}}_{2},{\tilde{r}}_{3},\dots ,{\tilde{r}}_{m})}^{\u22ba}$ and $\tilde{c}\left(g\right)=({\tilde{c}}_{2},{\tilde{c}}_{3},\dots ,{\tilde{c}}_{n})$. Let

- Generate $(r,c)=(\overline{r},\overline{c})$ from $inv\left(g\right)$.
- If ${\parallel r\parallel}_{1}-{\parallel c\parallel}_{1}$ is not an even number, flip all the parity bits in either r or c.
- If ${max\{m-\parallel r\parallel}_{1},n-{\parallel c\parallel}_{1}{\}<max\{\parallel r\parallel}_{1}{,\parallel c\parallel}_{1}\}$, then flip all the parity bits in both r and c.
- Construct a game that has a parity pair $(r,c)$ (by using the construction in the proof of thm:paritydiff), and such game is denoted as the coset leader.

#### 4.3. Covering Radius

**Even-by-Even Games**. All even-by-even games are solvable, so the covering radius is trivially 0.

**Even-by-Odd Games**. Recall that for each coset C,

**Odd-by-Odd Games**. Consider a syndrome $(\tilde{r},\tilde{c})$ of a game in a coset C. Let $b=\parallel \tilde{r}{\parallel}_{1}$ and $a=\parallel \tilde{c}{\parallel}_{1}$. Each possible syndrome in ${\mathbb{F}}_{2}^{(m-1)\times 1}\times {\mathbb{F}}_{2}^{1\times (n-1)}$ corresponds to a distinct coset; therefore, it suffices to consider all possible $b\in \{0,1,\dots ,m-1\}$ and $a\in \{0,1,\dots ,n-1\}$. Note that we are considering the syndrome but not the parity pair, and therefore $a-b$ can either be even or odd.

#### 4.4. Error Correction

**Even-by-Even Games**. All even-by-even games are solvable; therefore, there is no unsolvable game for discussion.

**Even-by-Odd Games**. When $n>1$, the Hamming distance is 2. Thus, the code has single error-detecting ability, but with no error-correcting ability.

**Odd-by-Odd Games**. When $m>1$ and $n=1$, the code is again a repetition code as previously mentioned. However, in this context, m is an odd number; therefore, the code has $\frac{m-1}{2}$ error-correcting ability.

- Calculate the syndrome $inv\left(g\right)=({({\tilde{r}}_{2},{\tilde{r}}_{3},\dots ,{\tilde{r}}_{m})}^{\u22ba},({\tilde{c}}_{2},{\tilde{c}}_{3},\dots ,{\tilde{c}}_{n}))$ of the given game g;
- Initialize $r={(0,{\tilde{r}}_{2},{\tilde{r}}_{3},\dots ,{\tilde{r}}_{m})}^{\u22ba}$, $c=(0,{\tilde{c}}_{2},{\tilde{c}}_{3},\dots ,{\tilde{c}}_{n})$, $A={\parallel r\parallel}_{1}$, and $B={\parallel c\parallel}_{1}$;
- If $A-B$ is odd, then let $A=m-{\parallel r\parallel}_{1}$ and flip all the bits in r;
- If $max\{A,B\}=0$ or $max\{m-A,n-B\}=0$, then the game g is already solvable, and this procedure is then completed;
- If $max\{A,B\}>1$ and $max\{m-A,n-B\}>1$, then there is more than one error, which implicates that the errors cannot be uniquely corrected. Therefore, the procedure can again be terminated;
- If $max\{A,B\}>max\{m-A,n-B\}$, then flip all the bits in both vectors r and c;
- Let y and x be the indices where the y-th entry in r is 1 and the x-th entry in c is 1. Then, the $(y,x)$-th light in g is the only error position.

## 5. As an Error-Correcting Code

#### 5.1. Even-by-Odd Games

- Calculate the row parity vector $r\left(g\right)$ of the game g.
- If $r\left(g\right)\ne {\mathbf{0}}_{m,1}$ and $r\left(g\right)\ne {\U0001d7d9}_{m,1}$, then we have detected the existence of errors, but we cannot decode the game; thus, the decoding procedure can be terminated.
- The game has no errors; thus, the message can be recovered by referring to the matrix.

**Theorem**

**5.**

**Proof.**

#### 5.2. Odd-by-Odd Games

**Theorem**

**6.**

**Proof.**

- The first type of output indicates the game is a solvable one. Therefore, we can directly extract the message $({b}_{1},{b}_{2},\dots ,{b}_{mn-m-n+2})$.
- The second type of output indicates the game has more than one error, so the error correction is non-unique. Thus, we consider the code as non-decodable.
- The third type of output indicates the location of the single error. Let $(y,x)$ be the location of the error, we can correct the error by flipping the $(y,x)$-th bit of the game grid.

#### 5.3. Example

## 6. States Decomposition

- Find a move sequence k that solves the two-state Alien Tiles $g\phantom{\rule{0.277778em}{0ex}}mod\phantom{\rule{0.277778em}{0ex}}2$.
- Calculate $z=\frac{1}{2}(\mathsf{\Psi}k-g)$ without performing modulo.
- Find a move sequence y that solves the two-state Alien Tiles $z\phantom{\rule{0.277778em}{0ex}}mod\phantom{\rule{0.277778em}{0ex}}2$.
- The move sequence in solving the four-state Alien Tiles g is $k+2y$.

## 7. Conclusions

## Supplementary Materials

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Acknowledgments

## Conflicts of Interest

## Abbreviations

P | polynomial time |

NP | non-deterministic polynomial time |

XOR | exclusive OR |

## Appendix A. Proof of Theorem 2

## Appendix B. Proof of Theorem 4

## Appendix C. Proof of thm:optimal

## References

- Kreh, M. “Lights Out” and Variants. Am. Math. Mon.
**2017**, 124, 937–950. [Google Scholar] [CrossRef] - The Mathematics of Lights Out. Available online: https://www.jaapsch.net/puzzles/lomath.htm (accessed on 20 March 2022).
- Anderson, M.; Feil, T. Turning Lights Out with Linear Algebra. Math. Mag.
**1998**, 71, 300–303. [Google Scholar] [CrossRef] - Rhoads, G.C. A Group Theoretic Solution to the Alien Tiles Puzzle. J. Recreat. Math.
**2007**, 36, 92–103. [Google Scholar] - Goldwasser, J.; Klostermeyer, W.; Trapp, G. Characterizing Switch-Setting Problems. Linear Multilinear Algebra
**1997**, 43, 121–135. [Google Scholar] [CrossRef] - Sutner, K. The σ-Game and Cellular Automata. Am. Math. Mon.
**1990**, 97, 24–34. [Google Scholar] - Berlekamp, E.; McEliece, R.; van Tilborg, H. On the Inherent Intractability of Certain Coding Problems. IEEE Trans. Inf. Theory
**1978**, 24, 384–386. [Google Scholar] [CrossRef] - Barg, S. Some New NP-Complete Coding Problems. Probl. Peredachi Informatsii
**1994**, 30, 23–28. [Google Scholar] - Stern, J. Approximating the Number of Error Locations within a Constant Ratio is NP-Complete. In Proceedings of the 10th International Symposium on Applied Algebra, Algebraic Algorithms and Error-Correcting Codes, San Juan de Puerto Rico, Puerto Rico, 10–14 May 1993; pp. 325–331. [Google Scholar]
- Arora, S.; Babai, L.; Stern, J.; Sweedyk, Z. The Hardness of Approximate Optima in Lattices, Codes, and Systems of Linear Equations. J. Comput. Syst. Sci.
**1997**, 54, 317–331. [Google Scholar] [CrossRef] - Roth, R.M.; Viswanathan, K. On the Hardness of Decoding the Gale-Berlekamp Code. IEEE Trans. Inf. Theory
**2008**, 54, 1050–1060. [Google Scholar] [CrossRef] - Karpinski, M.; Schudy, W. Linear Time Approximation Schemes for the Gale-Berlekamp Game and Related Minimization Problems. In Proceedings of the Forty-First Annual ACM Symposium on Theory of Computing, Bethesda, MD, USA, 31 May–2 June 2009; pp. 313–322. [Google Scholar]
- Carlson, J.; Stolarski, D. The Correct Solution to Berlekamp’s Switching Game. Discret. Math.
**2004**, 287, 145–150. [Google Scholar] [CrossRef] - Schauz, U. Colorings and Nowhere-Zero Flows of Graphs in Terms of Berlekamp’s Switching Game. Electron. J. Comb.
**2011**, 18. [Google Scholar] [CrossRef] - Brualdi, R.A.; Meyer, S.A. A Gale-Berlekamp Permutation-Switching Problem. Eur. J. Comb.
**2015**, 44, 43–56. [Google Scholar] [CrossRef] - Vardy, A. Algorithmic Complexity in Coding Theory and the Minimum Distance Problem. In Proceedings of the Twenty-Ninth Annual ACM Symposium on Theory of Computing, El Paso, TX, USA, 4–6 May 1997; pp. 92–109. [Google Scholar]
- Pickover, C.; Mckechnie, C. Alien Tiles Official Web Page. Available online: http://www.alientiles.com/ (accessed on 31 March 2022).
- Lights Out Variant: Flipping the Whole Row and Column. Available online: https://math.stackexchange.com/questions/441571/lights-out-variant-flipping-the-whole-row-and-column (accessed on 7 May 2021).
- Strategy for Modified Lights Out. Available online: https://puzzling.stackexchange.com/questions/58374/strategy-for-modified-lights-out (accessed on 26 September 2020).
- The Pilots Brothers’ Refrigerator. Available online: http://poj.org/problem?id=2965 (accessed on 25 September 2021).
- Maier, P.; Nickel, W. Attainable Patterns in Alien Tiles. Am. Math. Mon.
**2007**, 114, 1–13. [Google Scholar] [CrossRef] - Torrence, B. The Easiest Lights Out Games. Coll. Math. J.
**2011**, 42, 361–372. [Google Scholar] [CrossRef] - Characterize the Nullspace of a Given Matrix in F2n×n. Available online: https://math.stackexchange.com/questions/1056944/characterize-the-nullspace-of-a-given-matrix-in-mathbbf-2n-times-n (accessed on 7 May 2021).
- Minimal Number of Moves Needed to Solve a “Lights Out” Variant. Available online: https://math.stackexchange.com/questions/1052609/minimal-number-of-moves-needed-to-solve-a-lights-out-variant (accessed on 7 May 2021).
- How Can I Further Optimize This Solver of a Variant of “Lights Out”? Available online: https://stackoverflow.com/questions/27436275/how-can-i-further-optimize-this-solver-of-a-variant-of-lights-out (accessed on 6 May 2021).
- Singleton, R. Maximum Distance q-nary Codes. IEEE Trans. Inf. Theory
**1964**, 10, 116–118. [Google Scholar] [CrossRef] - 027: Alien Tiles Problem. Available online: https://www.csplib.org/Problems/prob027/ (accessed on 10 December 2021).
- Gent, I.; Linton, S.; Smith, B. Symmetry Breaking in the Alien Tiles Puzzle; Technical Report APES-22-2000; APES Research Group: Glasgow, UK, 2000. [Google Scholar]
- Gent, I.P.; Harvey, W.; Kelsey, T. Groups and Constraints: Symmetry Breaking during Search. In Proceedings of the International Conference on Principles and Practice of Constraint Programming, Ithaca, NY, USA, 9–13 September 2002; pp. 415–430. [Google Scholar]
- McDonald, I.; Smith, B. Partial Symmetry Breaking. In Proceedings of the International Conference on Principles and Practice of Constraint Programming, Ithaca, NY, USA, 9–13 September 2002; pp. 431–445. [Google Scholar]
- Cormen, T.H.; Leiserson, C.E.; Rivest, R.L.; Stein, C. Introduction to Algorithms, 3rd ed.; MIT Press: Cambridge, MA, USA, 2009. [Google Scholar]
- Wegener, I. Complexity Theory: Exploring the Limits of Efficient Algorithms; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2005. [Google Scholar]
- Jaffe, A.M. The Millennium Grand Challenge in Mathematics. Not. AMS
**2006**, 53, 652–660. [Google Scholar] - Cook, S. The Importance of the P versus NP Question. J. ACM
**2003**, 50, 27–29. [Google Scholar] [CrossRef] - Fortnow, L. The Golden Ticket: P, NP, and the Search for the Impossible; Princeton University Press: Princeton, NJ, USA, 2013. [Google Scholar]
- Gasarch, W.I. Guest Column: The P=?NP Poll. ACM SIGACT News
**2002**, 33, 34–47. [Google Scholar] - Gasarch, W.I. Guest Column: The Second P=?NP Poll. ACM SIGACT News
**2012**, 43, 53–77. [Google Scholar] [CrossRef] - Gasarch, W.I. Guest Column: The Third P=?NP Poll. ACM SIGACT News
**2019**, 50, 38–59. [Google Scholar] [CrossRef] - Huffman, W.C.; Pless, V. Fundamentals of Error-Correcting Codes; Cambridge University Press: Cambridge, UK, 2003. [Google Scholar]
- Ling, S.; Xing, C. Coding Theory: A First Course; Cambridge University Press: Cambridge, UK, 2004. [Google Scholar]
- Reed, I.S.; Solomon, G. Polynomial Codes over Certain Finite Fields. J. Soc. Ind. Appl. Math.
**1960**, 8, 300–304. [Google Scholar] [CrossRef] - Cohen, G.; Honkala, I.; Litsyn, S.; Lobstein, A. Covering Codes; Elsevier: Amsterdam, The Netherlands, 1997. [Google Scholar]
- Hämäläinen, H.; Honkala, I.; Litsyn, S.; Östergård, P. Football Pools—A Game for Mathematicians. Am. Math. Mon.
**1995**, 102, 579–588. [Google Scholar] [CrossRef] - Plotkin, M. Binary Codes with Specified Minimum Distance. IRE Trans. Inf. Theory
**1960**, 6, 445–450. [Google Scholar] [CrossRef] - Gilbert, E.N. A Comparison of Signalling Alphabets. Bell Syst. Tech. J.
**1952**, 31, 504–522. [Google Scholar] [CrossRef] - Varshamov, R.R. Estimate of the Number of Signals in Error Correcting Codes. Docklady Akademii Nauk SSSR
**1957**, 117, 739–741. [Google Scholar] - Delsarte, P. An Algebraic Approach to the Association Schemes of Coding Theory. Ph.D. Thesis, Université Catholique de Louvain, Ottignies-Louvain-la-Neuve, Belgium, 1973. [Google Scholar]
- Schrijver, A. New Code Upper Bounds from the Terwilliger Algebra and Semidefinite Programming. IEEE Trans. Inf. Theory
**2005**, 51, 2859–2866. [Google Scholar] [CrossRef] - Tietäväinen, A. On the Nonexistence of Perfect Codes over Finite Fields. SIAM J. Appl. Math.
**1973**, 24, 88–96. [Google Scholar] [CrossRef] - Laeser, R.P.; McLaughlin, W.I.; Wolff, D.M. Engineering Voyager 2’s Encounter with Uranus. Sci. Am.
**1986**, 255, 36–45. [Google Scholar] [CrossRef] - Forney, G. Generalized Minimum Distance Decoding. IEEE Trans. Inf. Theory
**1966**, 12, 125–131. [Google Scholar] [CrossRef] - Hamming, R.W. Error Detecting and Error Correcting Codes. Bell Syst. Tech. J.
**1950**, 29, 147–160. [Google Scholar] [CrossRef]

**Figure 5.**Two examples of mapping a sequence of moves in the move space K to a game in the game space G via the homomorphism $\psi $ for two-state Alien Tiles.

**Figure 9.**An example of constructing a game from the parity pairs. (

**a**) Bit-matching phase. (

**b**) Bit-pairing phase. (

**c**) Constructed game.

**Table 1.**The condition to flip all the bits in the parity pair $(r,c)$ for encoding a message to an odd-by-odd game, where $m,n\ge 3$.

${\parallel \mathit{r}\parallel}_{1}\phantom{\rule{0.277778em}{0ex}}mod\phantom{\rule{0.277778em}{0ex}}2$ (or ${\parallel \mathit{c}\parallel}_{1}\phantom{\rule{0.277778em}{0ex}}mod\phantom{\rule{0.277778em}{0ex}}2$) | ${\mathit{b}}_{\mathbf{mn}-\mathit{m}-\mathit{n}+2}$ | Flip? |
---|---|---|

0 | 0 | No |

0 | 1 | Yes |

1 | 0 | Yes |

1 | 1 | No |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Yin, H.H.F.; Ng, K.H.; Ma, S.K.; Wong, H.W.H.; Mak, H.W.L.
Two-State Alien Tiles: A Coding-Theoretical Perspective. *Mathematics* **2022**, *10*, 2994.
https://doi.org/10.3390/math10162994

**AMA Style**

Yin HHF, Ng KH, Ma SK, Wong HWH, Mak HWL.
Two-State Alien Tiles: A Coding-Theoretical Perspective. *Mathematics*. 2022; 10(16):2994.
https://doi.org/10.3390/math10162994

**Chicago/Turabian Style**

Yin, Hoover H. F., Ka Hei Ng, Shi Kin Ma, Harry W. H. Wong, and Hugo Wai Leung Mak.
2022. "Two-State Alien Tiles: A Coding-Theoretical Perspective" *Mathematics* 10, no. 16: 2994.
https://doi.org/10.3390/math10162994