The Mathematics of LightSwitch
LightSwitch is a topological variation of the classic "Lights Out" electronic game introduced in 1995. While it appears to be a simple pattern-matching game, it is actually a problem of Linear Algebra over a Finite Field (GF2).
Unlike the original game which used a single connectivity pattern, LightSwitch introduces variable "Adjacency Matrices"—changing the rules of how a single button press propagates across the grid.
Core Concepts & Rules
The game is played on a 3x3 grid (9 total nodes). The goal is to reach the "Zero State" (all lights off).
- Binary States: Each light has only two states: ON (1) or OFF (0).
- Modulo 2 Arithmetic: Tapping a light adds "1" to its state. 1+1 = 0 (Off). This means tapping a light twice is mathematically identical to never tapping it at all.
- Commutativity: The order in which you tap the lights does not matter. Tapping A then B produces the exact same result as tapping B then A.
The "Chase the Lights" Algorithm
The most reliable strategy for solving the standard Plus (+) pattern is a systematic reduction method known as "Chasing." This turns a 2D problem into a linear 1D problem.
Step 1: The Top Row
Ignore the state of the top row for a moment. Look at the second row. If a light in the top row is ON, you must tap the button directly below it (in the second row) to turn it off.
Step 2: The Cascade
Once the top row is dark, move your attention to the second row. If any lights are ON in the second row, tap the buttons directly below them (in the third row).
Step 3: The Bottom Row Problem
By the time you reach the bottom row, the top two rows will be completely dark. You will be left with a few lights on the bottom row. At this point, you must use a specific "Quiet Pattern"—a sequence of taps on the top row that cycles the board state without disturbing the solved rows—to clear the final lights.
Understanding the Topologies
LightSwitch increases difficulty by altering the shape of the "influence" each button has:
- Plus (+) Pattern (Hard): This is the classic Von Neumann neighborhood (North, South, East, West). It creates a dense connectivity graph where changes ripple outward in a diamond shape.
- X Pattern (Hardest): This uses Diagonal adjacency. Because the center button controls 5 lights (itself + 4 corners) while corners only control 2, the "weight" of the center button is significantly higher, creating complex dependency chains.
- Diagonal (⧸⧹) Pattern (Normal): A disjointed topology where the board effectively splits into independent sub-grids. This is the easiest mode to learn because errors are localized to specific quadrants.