Scroll Thief — 99 of 138

Daniel M. Stelzer

Release 2

Section C - Coordinates and Infinite Signage

[This table is taken from Dynamic Rooms. If you use that extension, just comment this copy out. They're identical.]

Table of Direction Map Positioning

basedirmap-xmap-ymap-z
north010
northeast110
east100
southeast1-10
south0-10
southwest-1-10
west-100
northwest-110
up001
down00-1

Among the Shelves has a number called the current x.

Among the Shelves has a number called the current y.

Among the Shelves has a number called the current z.

Among the Shelves can be spherical, polar, or cartesian (this is its coordinate system property). Among the Shelves is spherical.

Instead of setting the black square to "spherical": now Among the Shelves is spherical.

Instead of setting the black square to "polar": now Among the Shelves is polar.

Instead of setting the black square to "cartesian": now Among the Shelves is cartesian.

To reset the shelves to the origin:

now the current x of Among the Shelves is zero;

now the current y of Among the Shelves is zero;

now the current z of Among the Shelves is zero;

now the black square is present.

After going to Among the Shelves:

reset the shelves to the origin;

continue the action.

To decide whether the shelves are at the origin:

if the current x of Among the Shelves is not zero, no;

if the current y of Among the Shelves is not zero, no;

if the current z of Among the Shelves is not zero, no;

yes.

[To decide which real number is the atan2 of (y - a real number) by (x - a real number):

if x > 0:

decide on the arctangent of (y/x);

else if x < 0:

if y < 0:

decide on the arctangent of (y/x) minus pi;

else:

decide on the arctangent of (y/x) plus pi;

else: [x = 0]

if y > 0:

decide on pi / 2;

else if y < 0:

decide on -pi / 2;

decide on zero. [Default: x=0 y=0]]

Include (-

[ Atan2 y x res;

@atan2 y x res;

return res;

];

-).

To decide which real number is the/-- atan2 of (y - a real number) by (x - a real number): (- Atan2(({y}), ({x})) -).

To decide which number is the printable angle of (phi - real number):

let theta be (phi times 180 / pi) to the nearest whole number;

if theta is less than zero, increase theta by 360;

decide on theta.

To say (N - a number) as library dots:

if N is zero:

say "a green circle";

else if N is less than zero:

let M be zero minus N;

say "[M] red dots";

else:

say "[N] blue dots".

To say (N - a number) as unsigned library dots:

if N is zero:

say "a white circle";

else:

say "[N] black dots".

To say the/-- current library sign:

let x be the current x of Among the Shelves;

let y be the current y of Among the Shelves;

let z be the current z of Among the Shelves;

if Among the Shelves is cartesian:

if the shelves are at the origin:

say "three green circles";

otherwise:

say "three patterns: [x as library dots], [y as library dots], [z as library dots]";

else if Among the Shelves is polar:

let r1 be given by r1 = root(x^2 + y^2) where r1 is a real number;

let r be r1 to the nearest whole number;

let theta be the printable angle of (atan2 of y by x);

say "[r as unsigned library dots], the number [theta], and [z as library dots]";

else if Among the Shelves is spherical:

let r be given by r = root(x^2 + y^2 + z^2) where r is a real number;

let rho be r to the nearest whole number;

let theta be the printable angle of (atan2 of y by x);

let phi be zero;

unless rho is zero, let phi be the printable angle of (arccosine of (z / rho));

say "[rho as unsigned library dots], then the numbers [theta] and [phi]";

A position marker is fixed in place in the Shelves. "A sign on one shelf marks your current place in the collection." Understand "sign" or "small" or "metal" or "plate" or "hanging" as the marker. The description of the marker is "A small metal plate hangs from each ladder. This one shows [current library sign]."

Instead of going when the location is Among the Shelves:

if the shelves are at the origin and the noun is east, continue the action; [It is still possible to get out; don't block that]

unless there is a basedir of (the noun) in the Table of Direction Map Positioning, continue the action; [This isn't a compass direction (IN or OUT)]

choose the row with a basedir of (the noun) in the Table of Direction Map Positioning;

increase the current x of the Shelves by the map-x entry;

increase the current y of the Shelves by the map-y entry;

increase the current z of the Shelves by the map-z entry;

say "You head further into the stacks. The sign now shows [the current library sign].";

if the shelves are at the origin: [Make sure the door only appears right at the origin]

now the black square is present;

say "You're back at the entrance now; the black square is visible again to the east[if the noun is west]. Wait[--]but you just came through there, and it had been an open gap between the shelves..[end if].";

otherwise:

now the black square is absent;

if the current x of the Shelves is greater than zero:

display the boxed quotation "It was said that, since vast amounts of

magic can seriously distort the mundane

world, the Library did not obey the

normal rules of space and time. It was

said that it went on forever. It was

said that you could wander for days

among the distant shelves...

- Terry Pratchett, 'Guards! Guards!'";

take full time.