Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7596123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:50:36+00:00 2026-05-30T21:50:36+00:00

Need ideas on programming an algorithm to solve a particular puzzle. Basically, the puzzle

  • 0

Need ideas on programming an algorithm to solve a particular puzzle.

Basically, the puzzle is:

There are 9 lights arranged in a 3×3 grid:
A B C
D E F
G H I
(lets say each letter represents a light)

If you turn on or off a light, the lights adjacent to it (up, down, left or right), but not diagonal, will turn on if they are are off, or turn off if they are on.
(e.g. if A is off, B is off, D is off and you turn on A, B and D will turn on as well)

If you are given a 3×3 grid with lights that are on or off arranged randomly, what would be the least number of lights you need to turn on or off, to turn off all the lights.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:50:37+00:00Added an answer on May 30, 2026 at 9:50 pm

    You can see this as a graph theory problem (http://en.wikipedia.org/wiki/Graph_theory).

    Each given state of your puzzle is a Vertice of the graph, and each light switching is an edge that takes the Graph to another state.

    Given a starting state, if you expand your graph breadth-first, your will find the sortest solution (http://en.wikipedia.org/wiki/Breadth-first_search).

    It is beyond the scope of this answer to expand more than this. But I can point you to a python script I made to solve a similar but different 3×3 problem:

    • http://www.pangasentertainment.com/rift_3x3/
    • http://www.pangasentertainment.com/rift_3x3/3x3_slider_rift.py

    You can study my script to see what and why it does to solve this problem, and apply the same concepts to solve your problem on whatever language you desire.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some ideas on how I can best solve this problem. I have
I'm programming a learning software. It works with question-/answercards. Now I need an algorithm
I need some advice when it comes to solving a sorting algorithm. This particular
I do a lot of heavy math programming. Often there is a need to
I need ideas on how to go about table layout problem. I want to
I need ideas to implement a (really) high performance in-memory Database/Storage Mechanism in Java.
I need ideas to implement a (really) high performance in-memory Database/Storage Mechanism. In the
I need ideas for structuring and processing data with revisions. For example, I have
I need topic ideas related to AI on which I will base my thesis.
I need an idea for an efficient index/search algorithm, and/or data structure, for determining

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.