Puzzle / HTML5 + JAVASCRIPT

Lights Out

Turn off all 25 lights. Each tap flips one light and its immediate neighbors.

About this template

Lights Out is an original, self-contained browser starter. It focuses on grid neighbors, reversible toggles, and solvable puzzle generation. The interface and game logic live in one HTML file, so you can open the source and trace the interaction from input to screen without setting up a toolchain.

How to play

Tap a light to toggle it and its up, down, left, and right neighbors. Turn every light off to finish. Use the Start button to begin and Restart to try again. The game does not connect to a server or store a public score.

What is in the download?

The ZIP includes index.html, a quick-start README, and the MIT license. There are no external scripts, fonts, image assets, or package dependencies. Open index.html in a current browser to play; open it in a text editor to make changes.

Make your first change

Change the number of shuffle presses to generate a different opening. Starting from a solved board and applying legal toggles keeps the puzzle solvable.

  1. Save a copy of the original before editing.
  2. Change one value or rule, reload, and play a full round.
  3. Try both winning and losing paths. Then check the controls on a smaller screen.

Ideas for your own version

Start with the visual theme: adjust the background, accent color, and title. Next, add a rule that changes a decision the player makes. Prefer one well-tested mechanic over several unfinished systems. Keep a short note beside each new setting so the next person can understand why it exists.

Think in crosses

A center press changes five lights. An edge press changes four, and a corner changes three. Diagonals do not change. Tapping the same square twice cancels that action, and the order of different presses does not affect the final board.

A way to work through the board

Try working from the top row downward: press directly below a light you want to turn off in the row above. This helps organize your moves, although a final lit row may require revising the first row of presses. Every generated opening comes from legal moves on an all-off board, so a solution exists. The move counter is for your own practice, with no time limit.

Before you publish

This is a learning starter, not a full game engine. It has no network multiplayer, cloud saving, or commercial art pack. Add your own polish, test your target browsers, and follow the publishing checklist. The included code can be adapted for personal or commercial projects under the MIT license.