Blue Lacuna — 274 of 467

Aaron A. Reed

Release 4

Section - Movement Processing

[ Because pathfinding is an inherently time-intensive operation, especially with a map as large as ours, and because Progue confines himself to a relatively small part of the island, we include some shortcut code and lookup tables to speed up the process when Progue needs to move.]

To decide which direction is the Lacuna route from (origin - a room) to (destination - a room):

if origin is Tidepools, decide on northeast;

if origin is Ocean Waters, decide on east;

if origin is Chairlift Base, decide on southeast;

if origin is Ledge, decide on down;

if origin is Hot Springs, decide on west;

let dirnum be 0;

if there is a dest of destination in Table of PPF begin;

if origin is North Beach, now dirnum is the nbc corresponding to a dest of destination in Table of PPF;

if origin is Center Beach, now dirnum is the cbc corresponding to a dest of destination in Table of PPF;

if origin is South Beach, now dirnum is the sbc corresponding to a dest of destination in Table of PPF;

if origin is Among the Boulders, now dirnum is the atb corresponding to a dest of destination in Table of PPF;

if origin is Lower Beach, now dirnum is the lb corresponding to a dest of destination in Table of PPF;

if origin is Tidepools, now dirnum is the td corresponding to a dest of destination in Table of PPF;

if origin is Rise, now dirnum is the rise corresponding to a dest of destination in Table of PPF;

if origin is Stumps, now dirnum is the stp corresponding to a dest of destination in Table of PPF;

if origin is West-Marsh, now dirnum is the wm corresponding to a dest of destination in Table of PPF;

if origin is East Marsh, now dirnum is the em corresponding to a dest of destination in Table of PPF;

if origin is North Marsh, now dirnum is the nm corresponding to a dest of destination in Table of PPF;

if origin is Hut, now dirnum is the ht corresponding to a dest of destination in Table of PPF;

if origin is Studio, now dirnum is the std corresponding to a dest of destination in Table of PPF;

if origin is Back Room, now dirnum is the br corresponding to a dest of destination in Table of PPF;

if origin is Ocean Waters, now dirnum is the ow corresponding to a dest of destination in Table of PPF;

if dirnum is 0 begin;

if Progue is being debugged, say "// Progue: ERROR: can't find a route from [origin] to [destination]; resetting progue-venue to Center Beach.";

decide on the best route from origin to destination;

otherwise;

if dirnum is 1, decide on north;

if dirnum is 2, decide on northeast;

if dirnum is 3, decide on east;

if dirnum is 4, decide on southeast;

if dirnum is 5, decide on south;

if dirnum is 6, decide on southwest;

if dirnum is 7, decide on west;

if dirnum is 8, decide on northwest;

if dirnum is 9, decide on up;

end if;

otherwise;

decide on the best route from origin to destination;

end if.

Table of PPF [ Progue PathFinding]

destnbccbcsbcatblbtdrisestpwmemnmhtstdbrow
North Beach--11222456767573
Center Beach5--1232456767573
South Beach55--242456767573
Among the Boulders556--52456767573
Lower Beach6781--2456767573
Tidepools55665--456767573
Ocean Waters67817245676757--
Hut531232456767573
Rise811222--56767573
Stumps8112221--6767573
Chairlift Base811222186767573
West-Marsh81122212--767573
East Marsh811222123--57573
North Marsh8112221221--7573
Ledge811222122197573
Hot Springs811222356767573
Studio531232456761--73
Back Room5312324567635--3

[ Progue will never venture into certain parts of the island; if he is tracking down the player, he needs to know where the boundaries are.]

To decide whether (destination - a room) is off limits to Progue:

if Progue is being debugged, say "// Progue: deciding whether [destination] is off limits to Progue.";

if destination is Jumble or destination is Fork or destination is Cliffside or destination is Saddle, decide yes;

if destination is regionally in Beachfront or destination is regionally in Progue's Domain or destination is Tidepools or destination is Lower Beach or destination is Ocean Waters or destination is Rise or destination is Hot Springs or destination is regionally in North Island or destination is regionally in Marshlands or destination is Ledge, decide no;

decide yes.

To decide whether exploring Progue's turf:

if the player is in North Island or the player is in Marshlands or the player is in Beachfront or the player is in Progue's Domain or the player is in Tidepools or the player is in Lower Beach or the player is in Ocean Waters or the player is in Ledge, decide yes;

decide no.