# Escape the Klotski dungeon!

Help! I am trapped in a dungeon with multiple rooms full of sliding tiles! I need to find a way of sliding the tiles such that the 2x2 tile can be freed, by sliding it out of the exit on the North side of the dungeon.
There are some restrictions: every tile in a given room can only be slid if the 2x2 tile is completely inside that room, and that is the only tile that can traverse a passageway: ==.

Here is the floor-plan of the dungeon:

                  │ ░░░░░░░ │
┌───┘·········└───┐
│     ┌─────┐     │
│     └─────┘     │   119
│ ┌─────┐ ┌─────┐ │
│ └─────┘ └─────┘ │
│ ┌─┐ ┌─┐ ┌─┐ ┌─┐ │
│ │ │ └─┘ └─┘ │ │ │
│ │ │         │ │ │
│ └─┘         └─┘ │
│ ┌─┐         ┌─┐ │
│ └─┘         └─┘ │
└───┐·········┌───┘
│ ░░░░░░░ │
┌───┘·········└───┐
│ ┌─────┐ ┌─┐ ┌─┐ │
│ └─────┘ │ │ │ │ │    54
│ ┌─────┐ │ │ │ │ │
│ └─────┘ └─┘ └─┘ │
│ ┌─────┐ ┌─┐ ┌─┐ │
│ └─────┘ └─┘ └─┘ │
│ ┌─┐             │
│ └─┘             │
│ ┌─┐             │
│ └─┘             │
└───┐·········┌───┘
│ ░░░░░░░ │
┌───┘·········└───┐
│ ┌─┐ ┌─┐ ┌─────┐ │
│ │ │ │ │ └─────┘ │    41
│ │ │ │ │ ┌─┐ ┌─┐ │
│ └─┘ └─┘ └─┘ └─┘ │
│ ┌─────┐ ┌─────┐ │
│ └─────┘ └─────┘ │
│ ┌─┐ ╔═════╗     │
│ └─┘ ║     ║     │
│ ┌─┐ ║     ║     │
│ └─┘ ╚═════╝     │
└─────────────────┘


Note: The 2x2 tile which must be freed is represented with a double outline. The number next to each room can be considered as a difficulty level, as it is the required number of single piece single unit moves.

Here is a more compact version, useful for shortening answers:

 |==|
++==++
| HH |
|HHHH|
|VSSV| 119
|V  V|
|S  S|
++==++
|==|
++==++
|HHVV|
|HHVV|
|HHSS| 54
|S   |
|S   |
++==++
|==|
++==++
|VVHH|
|VVSS|
|HHHH| 41
|SRR |
|SRR |
+----+

• I've taken the liberty to change the visual representation of the dungeon to something that I think is easier to understand. Feel free to roll back it you don't like it. – M Oehm Jul 24 '17 at 7:13
• Yes, sure. I didn't care about such practical considerations when proposing it. :) – M Oehm Jul 24 '17 at 9:17
• The number next to each room can be considered as a difficulty level, as it is the required number of single piece single unit moves. Are you suggesting that we would present a solution with 121 visual steps? Or is this looking for a proof of some sort? – Forklift Jul 24 '17 at 12:31
• Can you confirm that the third puzzle is actual able to be solved? – Engineer Toast Jul 24 '17 at 16:17
• @EngineerToast my solver confirms an extremely lengthy solution. – greenturtle3141 Jul 24 '17 at 16:48

Bottom Puzzle:

Middle Puzzle:

Top Puzzle: (AKA: Pain and a half)

Due to the sheer number of steps, I had to animate this one.
It loops forever so, if you missed the beginning, just wait.

My solution takes 119 steps.
I saved 10 steps thanks to Zizy Archer but OP has pointed out where I actually skipped steps in several places. I'm doing this all in Excel and never programmatically checked it. I added a helper to my original file and think I ferreted out all the issues. Every move either changes the color of two squares (single block moving or long block moving along its long axis) or two squares (long block moving along its short axis or big block moving). I programmatically found and then manually checked all the four square color changes. However, as OP has proven so excellent at finding my errors, here's a slower version of the GIF above in case someone else can find an error. That seems likely since I'm still two moves shorter than OP's solver that did the entire thing programmatically.

The steps count a two square movement in the same direction as two steps and does not include the first and last frames (starting position and escaped position). Per OP, this is how their solver counted as well.

• just about the best explanation i have seen – Jason V Jul 24 '17 at 22:33
• I use the same step metric, so there is a shorter solution to be found! – micsthepick Jul 24 '17 at 23:17
• @micsthepick I realized that my number of 128 includes the first and last positions. Are those both included in your number of 121? – Engineer Toast Jul 26 '17 at 14:06
• I don't include the either position (it takes 0 moves to get to the first position), and I also only count up to alignment with the end, not taking it through – micsthepick Jul 26 '17 at 21:55
• Actually, you don't completely follow this: "Of course, I count moving a single block two spots in one direction as being two steps". Between step 8 and 9 (or 7 and 8), you move the brown single block twice in one direction. – micsthepick Jul 26 '17 at 22:58