Skip to main content

koyu doors

Gives the route from one space to another through the fewest doors on the space graph. It is the escape-and-circulation question.

Arguments

koyu doors <entry.muro> <pathA> <pathB>

After the entry path, give the departure and arrival space paths. Both are required.

Flags

None.

Output

One line: the number of doors, and the spaces passed through.

npx tsx src/cli.ts doors examples/two-rooms.muro /L1/a /out
2 doors — /L1/a → /L1/b → /out

The route is a list of spaces, not of doors. Boundaries that cost no door — open, stairs — also appear along it.

npx tsx src/cli.ts doors examples/house/main.muro /home/bed1 /out/road
3 doors — /home/bed1 → /home/hall2 → /home/hall1 → /site/east → /site/garden → /out/road

Five boundaries are crossed but only 3 doors counted. /home/hall2 → /home/hall1 is a stair and /site/east → /site/garden is open, so neither counts.

When there is no route, it says so.

npx tsx src/cli.ts doors examples/house/main.muro /home/bed9 /site/garden
Cannot reach /site/garden from /home/bed9

What is passable

BoundaryPassable
A wall with doorsYes (the doors are counted)
A wall with no doorsNo
openYes (no door counted)
A wall with air:1 (railings, fences, garden walls)Noair is about enclosure, not about passage
stairYes (no door counted)
shaft (lifts and the like)No
voidNo

Boundaries you never wrote are used too. The default between touching spaces is a wall, and a wall with no doors is impassable, so a contact you did not write acts to block the route.

Paths that do not exist

A mistyped path also produces "cannot reach". A typo and a genuine dead end give the same message and the same exit code 1. The /home/bed9 above is not a space that exists.

When you get "cannot reach", check the spelling with koyu graph first. The exterior is not necessarily one space — in examples/house it is split into /out/road, /out/n, /out/e and /out/w, and there is no space called /out.

Exit codes

Exit codeMeaning
0It can be reached
1It cannot be reached (including via a path that does not exist), or the input could not be read
2Two paths were not given / no file path was given
npx tsx src/cli.ts doors examples/house/main.muro /home/bed1
Usage: koyu doors <file> /pathA /pathB

One pair at a time

doors answers about the one pair you gave it. To ask whether any room at all fails to reach the outside, use koyu validateaccess.unreachable tests reachability to the exterior for every room that has a region.

See also