News for hackers. Stuff that matters.
Re:Generating Lever-Door Puzzles with JavaScript by HWR_14 on Tuesday November 05, 2024 @07:35PM (#42056463)
It requires 2^(x-1) levers to guarantee you can precisely toggle the state of all the doors. You have add other restrictions, e.g. that all doors must be controlled by at least one lever, all doors must have at least one lever that does not control them, then X levers would be sufficient.

With three doors, you have levers (1,0,0), (0,1,0), (1,1,0) and any fourth unique non null lever. In general, you have a set of 2^(x-1) levers that don't touch the Xth door, and then you replace the null lever with anything that includes the Xth door and you are fine.

Re:Generating Lever-Door Puzzles with JavaScript by AnotherGoodName on Tuesday November 05, 2024 @07:47PM (#42056514)
That actually makes a lot of sense and means it was a coincidence that the 2 and 3 door cases needed 2 and 3 levers (accepting the 0,0,0 as a starting state - it can actually be considered another lever).

The four lever counter example (0001, 0010, 0011, 0100) - door 0 is never touched by any of these is clear. It was just that 2^(x-1) covered the respective space in the 2 and 3 lever cases, heh. Thanks!