Home
Posted on 8/14/2021
Tags: Games, Programming
Tap or click and take a trip down memory lane with the historic Lights Off. Exactly fourteen years ago today Wired got the scoop: Lights Off: First iPhone Native Game Arrives.

And today I'm sharing a new implementation that everyone can play in their web browser:

Play here!


Lights Off's story begins with Tiger Electronics who launched their game Lights Out in 1995. Then in 2007 Lucas Newman and Adam Betts cloned the game for the iPhone's touch screen. Notably, they built the game before there was an official iPhone SDK or App Store. It was only available to jailbreakers!

A year later, Craig Hockenberry wrote a post to commemorate the milestone and share the source code (my backup).

Since then the app was rebuilt and modernized by Steve Troughton-Smith as possibly the oldest still-actively-maintained app on the App Store. You can find his version here.

For more history on the App Store and its first killer apps, check out this article (also written by Craig Hockenberry - mirror on the iconfactory website).


In the process of building the web version, I wrote tests (source code) to ensure every level is solvable. To my surprise almost half of the original levels cannot be solved! How cruel! This was probably a mistake in how the levels were generated - maybe by flipping certain lights on without checking that the overall puzzle was valid.

To replace the bad levels, I generated my own levels of increasing difficulty by ramping up the minimum number of taps required to solve each puzzle. My algorithm can be found in the unit tests code in the "test_generateLevels" method. This could even be hooked into the game itself for an "endless" mode.

If ever you can't figure out how to solve a level in the fewest taps, there's a guaranteed method to win called "light chasing" or "chase the lights":
- Start on the top row
- For every lit button in the row, turn it off by tapping the button in the row right below it
- Repeat until you get to the bottom row
- At this point, the bottom row will have one of seven patterns. Based on the pattern, tap the specific circled cells on the top row and repeat these steps. By the time you reach the bottom row again, every light will be off!
⬛⬛⬛⬛⬛ ⬛⭕️⬛⬛⬛
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ => ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
🟡🟡🟡⬛⬛ 🟡🟡🟡⬛⬛


⬛⬛⬛⬛⬛ ⬛⬛⬛⭕️⬛
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ => ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
⬛⬛🟡🟡🟡 ⬛⬛🟡🟡🟡


⬛⬛⬛⬛⬛ ⬛⬛⭕️⬛⬛
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ => ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
🟡🟡⬛🟡🟡 🟡🟡⬛🟡🟡


⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⭕️
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ => ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
🟡⬛🟡🟡⬛ 🟡⬛🟡🟡⬛


⬛⬛⬛⬛⬛ ⭕️⬛⬛⬛⬛
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ => ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
⬛🟡🟡⬛🟡 ⬛🟡🟡⬛🟡


⬛⬛⬛⬛⬛ ⭕️⭕️⬛⬛⬛
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ => ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
🟡⬛⬛⬛🟡 🟡⬛⬛⬛🟡


⬛⬛⬛⬛⬛ ⭕️⬛⬛⭕️⬛
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ => ⬛⬛⬛⬛⬛
⬛⬛⬛⬛⬛ ⬛⬛⬛⬛⬛
⬛🟡⬛🟡⬛ ⬛🟡⬛🟡⬛
While every level can be beaten mechanically like this, it's still more fun (and often faster) to find the fewest taps needed! That's the real challenge.

Have fun! :)