[qb]
Projects

LightsOut

Implycitt·Python

README

main

Lights Out


About


Lights Out is an electronic puzzle game released by Tiger Electronics in 1995. The game starts with an N x N grid, usually 5x5, of lights in a randomly configured state: on or off. The goal is to turn off all the lights by pressing a sequence of lights that will toggle its direct neighbors. Interestingly, the board can be represented as a matrix, and with the help of some linear algebra we can solve directly for a solution to a given configuration. For those interested, a short explanation of the mathematics behind the solver can be found here.

The program simulates the game by creating a random, valid configuration. Additionally, there is a "solver" button that steps through the most efficient solution as well as a "new" button which refreshes the board with a new configuration.

Built With

  • Python
  • PyQt6
  • NumPy

Demo


demo

Getting Started


Prerequisites

This project was built with Python version 3.14.3. Please ensure that you use at least Python 3.14 for the program to be fully functional. Earlier versions have not been tested and are not guaranteed to work.

  • Python/pip
    sh
    py -m pip install --upgrade pip

Installation

  1. Clone the repo
    sh
    git clone https://github.com/Implycitt/LightsOut.git cd LightsOut
  2. Create a venv
    sh
    python3 -m venv .venv source .venv/bin/activate
  3. Install the packages
    pip install -r requirements.txt     
  4. run the main .py file
    sh
    python src/main.py

Resources


License


Distributed under the MIT license. See LICENSE.txt for more information.