# Tell me what kind of puzzle this is?

I’m having a go with creating a kind of puzzle I’ve seen in a game; I don’t know if it’s a common kind of puzzle or really how to go about making it so that it’s always solvable so any advice would be great.

Here’s the basic idea. You start with a number of slots, for example five. Each slot is set to either -1, 0, or 1, like so:

``-1 0 0 1 1``

Then you have a set of transformations you can apply in any order. For example,

``` +1 0 +1 0 0 -1 +1 0 +1 +1 ...etc.```

So the goal is to figure out what sequence of transforms will get you to ‘0 0 0 0 0’.

The game will randomly generate each one. Any suggestions on how to create this?

I think I would at the start of each game

– come up with the desired number of transformations by randomly setting the slot values
– verify that the transformations contained no duplicates; if duplicates were found, reroll those
– start out with the puzzle state at 0 0 0 0 0
– several times, at random, select a transformation from the transformation set and apply it backward to the puzzle state until I wound up with something mixed; this guarantees you can get back to 0 0 0 0 0 by applying the transformations in a forward order
– verify the result puzzle state was no longer 0 0 0 0 0 or the negation of any single existing transform (because that would make it a one-move solve); if that was not the case, do another round of random back-transformations.

I don’t know what you call this kind of puzzle, but it reminds me of a game on my iPhone.

I don’t know if I understood everything correctly, but:
in the way you suggest it, the sequence/order in which to apply these transformations isn’t relevant (only the right set). So when the player knows all available transformations (which he has to), the puzzle itself is not really hard to solve…

That’s true if each transform is used only once, so I guess you’d also have to randomly apply one or more transforms more than once?

Yes, or provide slightly more transformations than needed. Either way, it could be (easily) figured out by wild guessing…
This puzzle reminds me of something similar in Borderlands2, where you have 4 lightswitches connected to 5 lightbulbs which start in random on/off state. Tricky: the connections switch -> light are not persistent, but change unpredictably. If every light is on, you get a reward (someone to kill actually, since it’s Borderlands
Maybe you could adopt this, if your transformations are connected to levers: pulling it performs one transformation, but pushing it not the reverse action, but a different one.

You wouldn’t even need to reverse the transforms before applying them to create the puzzle, since the inverse is just the same thing applied twice. This property also means that the player can’t accidentally make it unwinnable: if you push the wrong lever, push the same one twice more and it undoes the effect.

That’s true if the slots wrap (mod 3). I wasn’t sure if that was the intent though. If the player can run off into the weeds ("-6 0 +2 +7 -1") then both the puzzle and the puzzle construction become harder.

I know this kind of thing has been done before (there’s a puzzle along this line in Zork: Nemesis) but I have no idea what the technical term for it is.

When the slots have two states, wrapping, then we call it “that damn turning the lights on puzzle”. I’m not sure I’ve run into a trinary version.

(I didn’t put a trinary version in System’s Twilight, did I? I don’t even remember.)

Oops, you’re right. I assumed that because of the numbers given in the original post, but I see now he didn’t actually specify that.

The very-simplified version of this is pretty damn common: you have N cylinders each with X sides, and rotating one also rotates some of the others (so the number of possible transforms is equal to the number of cylinders). Skyrim, for instance, has a version with four three-sided cylinders in the early game. At that scale you can figure it out in a pen-and-paper way, or just hack angrily away at it until it happens to slot into place.

In the game where I saw this there aren’t any bounds on the value of the slots, so repeatedly applying a transform will shift it further and further out. However I haven’t decided if I want to do that, since I probably want to put some kind of a cosmetic veneer on this so the player isn’t dealing with plain numbers at first glance.

That IF about doing your Christmas shopping has a quite big (4x4?) one of these with security cameras, I believe. Which is connected to its variant, the flipping-rows-in-a-grid-til-a-picture-is-complete puzzle, like in To The Moon.

Yes, I have seen similar things elsewhere myself. Generally, it’s for lock puzzles.

These sound like linear algebra puzzles (here’s an explanation of one with a long explanation of how to use a linear algebra program to solve it). The Grand Quest by Owen Parrish had one of these with playing cards in it. Victor Gijsbers talked about it a bunch here and here.

Thanks for remembering. The game was “Not Just an Ordinary Ballerina,” and it was my first effort at writing IF. The security cameras are indeed a 4x4 matrix with buttons for transformations.