Part Text Map
Include Enhanced Route Finding 6M62 by Daniel Stelzer. [Needed to determine which rooms the ghost can access]
A textmap is part of the notebook. Understand "text map" or "text" or "accessible" or "accessible map" as the textmap. The description of the textmap is "[accessible map].".
Definition: a room is frontier if it is visited and it is near an unvisited room in the mansion-region.
Definition: a room is jammed-adjacent if a seen jammed internal-door is liminal to it.
Definition: a room is ghost-reachable rather than ghost-unreachable if it is the location of the ghost or the best route from it to the location of the ghost using open unjammed doors is not nothing.
Definition: a room is unhauntable if it is not hauntable.
To say accessible map:
let N be the number of unvisited rooms in the mansion-region;
if N is not zero, say "There [regarding N][are] [N in words] room[s] unexplored: try the doors from [the list of frontier rooms].[p]";
let N be the number of seen jammed internal-doors;
if N is not zero, say "You've seen [regarding N][N in words] jammed door[s]: you can reach [them] from [the list of visited jammed-adjacent rooms].[p]";
if the location of the ghost is hauntable, say "From the sound, you know that the ghost is currently in [the location of the ghost].[p]";
let jam-present be whether or not there is a jammed door;
let unhaunt-present be whether or not there is an unhauntable room in the mansion-region;
let haunt-present be whether or not there is a hauntable room in the mansion-region;
let unreach-present be whether or not there is a ghost-unreachable room in the mansion-region;
let unhaunt-reach-present be whether or not there is a ghost-reachable unhauntable room in the mansion-region;
if haunt-present is false: [No ghost detectors]
say "You haven't set up any ghost detectors yet, but they'll be listed here once you do";
otherwise if unhaunt-present is false: [All ghost detectors]
say "You've set up ghost detectors in every room[if unreach-present is true], and confined the ghost to [the list of ghost-reachable rooms in the mansion-region][end if]";
otherwise if jam-present is true or unreach-present is false: [Ghost's movement not intentionally restricted]
let N be the number of hauntable rooms in the mansion-region;
say "You've set up [regarding N][N in words] ghost detector[s]. You're missing [the list of unhauntable rooms in the mansion-region]";
otherwise: [Ghost's movement restricted, some but not all detectors]
let N be the number of unhauntable ghost-reachable rooms;
say "The ghost is restricted to [the list of ghost-reachable rooms][if unhaunt-reach-present is true]. Out of those, [the list of unhauntable ghost-reachable rooms] [regarding N][do]n't have a detector[end if]";