(Part of my "eternity project" (ha-ha) to node Shadowgate tips, lest the future generations be stuck in the Castle forever =)

Shadowgate is one of the NES games that I like to play again at times, even when the game is a bit too simple after it is first solved with a couple of hints. (I did it just to see some of the interesting graphics... =)

I did it again this summer, and I finished it in a couple of sessions. It was not too hard!

The only *really* tricky puzzle in the game was the infamous lever puzzle.

## What kind of puzzle might that be?

The idea is simple: You have three levers (henceforth marked 1, 2, and 3 - game calls these the Left, Middle and Right levers). You're supposed to turn these levers up or down. You need to turn them three times. If the combination of turns was wrong, they revert to original position (all up) and you need to start from the beginning.

## Solution

...or how to humiliate sadistic game designers with practical application of everyday mathematics.

The fact is that you can make up to three lever turns. There are three possible levers. Thus there's only up to 3^{3} = 27 different solutions.

Since I'm not a mathematician, but I knew there was a very limited number of solutions, I made a diagram showing each of these states. (yeah, I'm a brute-force brute. My apologies for my existence.) Since that cannot be reproduced here, I just explain what I did.

First, it's possible to turn each of these levers. Let's just mark them like these:

1

2

3

Then, the second switch can be turned. It can be any of these three, so here's what we get:

11, 12, 13

21, 22, 23

31, 32, 33

And finally, the third switch added to these combinations, completing our list of possible combinations:

111, 112, 113, 121, 122, 123, 131, 132, 133

211, 212, 213, 221, 222, 223, 231, 232, 233

311, 312, 313, 321, 322, 323, 331, 332, 333

(The number indicates which levers will be flipped from one state to another, for example, 112 means "flip left down, flip left up, flip middle down" - it's not shown here whether the flip will be down or up, even when my diagram originally showed that. Reading the number and then flipping the respective levers is easier.)

I'm guessing here the game will pick up the combination at random, and while solving it gives no indication whatsoever on how close the guess was, so the only possibility is to try each of these combinations in order. Last time I tried, 322 (or 323?) was the solution, so I brute-forced my way through most of the possible answers. I only burned through two torches, and the second lasted through the rest of the game afterwards =)

It really helps to follow the list, because no way in hell you're going to find the correct answer by randomly turning the levers! (I'm firm believer in the fact that even brute force should be controlled...)