# Correct pass required

I was sent to a training centre, for a super secret meeting at 'No-Such-Agency', and arrived in Reception with the orange pass only to be told I must first visit Clearance with the brown pass, and then attend Vetting with the blue pass before returning to Reception with the green pass.

Whoever said that US. Government bureaucracy was easy?

• So this is a maze where the color of the walls shows which passes allow one to go through and the double edged arrow represent the possibility to trade one pass for another color pass? Jun 27 at 10:48
• @quarague I think figuring that out is meant to be part of the puzzle.
– fljx
Jun 27 at 11:25
• Feels similar to Chip's Challenge puzzles! Jun 28 at 6:36

Assuming the following rules:

- The squares on the grid edges are the doors with a pass colour that you need to pass from one room to another. (E.g. You can travel west from Reception with your orange pass, but not south to Vetting.)
- The paired arrows in each cell represent exchanging your pass for a different colour. (So in the room west of Reception you can exchange a green pass for purple or vice-versa.)
- Multiple swaps can be performed in a room. (E.g. In Vetting, you can exchange purple for green and then green for blue.)

First, some observations:

- If a room has only one door of a particular colour, and no exchange-arrows with that colour, then that room represents a dead-end for that pass colour. (E.g. Entering the top-left (north-westernmost) room with a green, brown, purple or blue pass.)

- If a room has only one exchange arrow with a particular colour, and no doors of that colour, then that exchange-arrow can be ignored. (E.g. The top-left room has no orange door, so the yellow-orange exchange is unusable.)

- These rules can be applied iteratively, and a number of paths (and some entire rooms) can be marked as unusable dead-ends. (E.g. In the top-left room, with the yellow-orange exchange marked unusable, the single yellow door is also unusable, and the entire room is a dead-end. Then in the room immediately east, the yellow-green exchange is unusuable, and the remaining doors are all unique colours, so this room is also a dead-end.) In fact, this enables us to ignore over half the rooms when searching for a path through.

With all those options crossed out, we end up with the following map:

Now the unique path that I can find is:

Reception: Orange pass
Go W twice
Swap Orange for Red
Go W thrice
Swap Red for Green
Go S
Go E twice
Swap Green for Blue
Go E
Swap Blue for Brown
Go E
Phew, we made it to Clearance. On to Vetting, which is right next door, but we can't get there with our Brown pass...
So we retrace our steps for a few rooms..
Go W
Swap Brown for Blue
Go W
Swap Blue for Green
Go W twice
Go N (here we diverge)
Swap Green for Purple for Brown
Go W
Go N
Go E
Go N
Swap Brown for Blue for Yellow
Go E
Swap Yellow for Orange
Go S twice
Go E
Go S
Swap Orange for Purple
Go E
Swap Purple for Red for Orange
Go E
Swap Orange for Purple
Go E
Swap Purple for Green for Blue
We made it to Vetting. Not much further now.
Swap Blue for Green
Go N
We are back at Reception with our Green pass.

Map:

• Looks good! I am sure I can do better! Jun 27 at 13:07
• Programmatically it could be represented by 7x9x7 nodes (rows * columns * colors) representing each state you could be in. Each door represents an edge of that color leading between nodes representing the touching rooms of that color. A color swapper represents an edge leading between two nodes of the same room of different colors. Flag the 'target' nodes 1-4 as non-removable and iterate through the nodes and remove any edges if they aren't flagged irremovable and have only one. You could still have cycles, but that should prune most of the nodes and edges. Jun 29 at 21:47