Spielerando

Check a lever puzzle can be solved and find the fewest pulls

Pull one lever and two others flip as well; the door wants all three up. Some such puzzles have no answer at all, and the designer finds out when a player writes in. Here is a search over every possible setting that tells you at once, and gives the shortest solution.

Why this works

A small puzzle has only so many settings, so a computer can try them all. Trying every pull from the start finds the shortest answer, or shows that none exists, long before a player gets stuck on something impossible.

When not to use it

Skip it when the puzzle has very many levers, or settings that change on their own over time. Trying everything then takes too long to be useful; check the structure by hand or by a rule, such as the odd-and-even test.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 4 common mistakes and the fix
  • A diagram of every state
  • 34 lines of example code with 3 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Check a lever puzzle can be solved and find the fewest pulls" (read_entry lever-puzzle-solvable-and-shortest) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP