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]
dest | nbc | cbc | sbc | atb | lb | td | rise | stp | wm | em | nm | ht | std | br | ow |
North Beach | -- | 1 | 1 | 2 | 2 | 2 | 4 | 5 | 6 | 7 | 6 | 7 | 5 | 7 | 3 |
Center Beach | 5 | -- | 1 | 2 | 3 | 2 | 4 | 5 | 6 | 7 | 6 | 7 | 5 | 7 | 3 |
South Beach | 5 | 5 | -- | 2 | 4 | 2 | 4 | 5 | 6 | 7 | 6 | 7 | 5 | 7 | 3 |
Among the Boulders | 5 | 5 | 6 | -- | 5 | 2 | 4 | 5 | 6 | 7 | 6 | 7 | 5 | 7 | 3 |
Lower Beach | 6 | 7 | 8 | 1 | -- | 2 | 4 | 5 | 6 | 7 | 6 | 7 | 5 | 7 | 3 |
Tidepools | 5 | 5 | 6 | 6 | 5 | -- | 4 | 5 | 6 | 7 | 6 | 7 | 5 | 7 | 3 |
Ocean Waters | 6 | 7 | 8 | 1 | 7 | 2 | 4 | 5 | 6 | 7 | 6 | 7 | 5 | 7 | -- |
Hut | 5 | 3 | 1 | 2 | 3 | 2 | 4 | 5 | 6 | 7 | 6 | 7 | 5 | 7 | 3 |
Rise | 8 | 1 | 1 | 2 | 2 | 2 | -- | 5 | 6 | 7 | 6 | 7 | 5 | 7 | 3 |
Stumps | 8 | 1 | 1 | 2 | 2 | 2 | 1 | -- | 6 | 7 | 6 | 7 | 5 | 7 | 3 |
Chairlift Base | 8 | 1 | 1 | 2 | 2 | 2 | 1 | 8 | 6 | 7 | 6 | 7 | 5 | 7 | 3 |
West-Marsh | 8 | 1 | 1 | 2 | 2 | 2 | 1 | 2 | -- | 7 | 6 | 7 | 5 | 7 | 3 |
East Marsh | 8 | 1 | 1 | 2 | 2 | 2 | 1 | 2 | 3 | -- | 5 | 7 | 5 | 7 | 3 |
North Marsh | 8 | 1 | 1 | 2 | 2 | 2 | 1 | 2 | 2 | 1 | -- | 7 | 5 | 7 | 3 |
Ledge | 8 | 1 | 1 | 2 | 2 | 2 | 1 | 2 | 2 | 1 | 9 | 7 | 5 | 7 | 3 |
Hot Springs | 8 | 1 | 1 | 2 | 2 | 2 | 3 | 5 | 6 | 7 | 6 | 7 | 5 | 7 | 3 |
Studio | 5 | 3 | 1 | 2 | 3 | 2 | 4 | 5 | 6 | 7 | 6 | 1 | -- | 7 | 3 |
Back Room | 5 | 3 | 1 | 2 | 3 | 2 | 4 | 5 | 6 | 7 | 6 | 3 | 5 | -- | 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.