Rock Garden
Example 366
★★A map of linked rooms works well for modeling enclosed or indoor space, and somewhat less well for modeling large open spaces, where a person should reasonably be able to see things which are much too far away to touch. With some modifications to scoping, though, we can create an environment where objects in nearby rooms are described and viewable, and where the player will automatically move towards distant items before interacting with them physically.
"Rock Garden"
Section 1 - General Rules
Intervisibility relates rooms to each other in groups. The verb to be connected with means the intervisibility relation.
Definition: a room is inter-visible if it is connected with more than one room.
After deciding the scope of the player when the location is an inter-visible room:
repeat with other place running through rooms which are connected with the location:
unless the other place is the location, place the other place in scope.
Rule for reaching inside a room (called target) which is connected with the location:
let way be the best route from the location to the target;
if the way is not a direction:
say "You can't get over to [the target] from here.";
deny access;
say "(first heading [way])[command clarification break]";
try going way;
if the player is in the target, allow access;
otherwise deny access.
After looking when the location is an inter-visible room:
repeat with other place running through rooms which are connected with the location:
if the other place is not the location, describe locale for other place.
Section 2 - The Scenario
Rock Garden West is west of Rock Garden East. Rock Garden East contains a rake. Rock Garden West contains a bench and a maple leaf. The bench is an enterable supporter.
Rock Garden West is connected with Rock Garden East.
Test me with "get rake / drop rake / sit on bench / get rake".
Test me with "get rake / drop rake / sit on bench / get rake".
Rock Garden West
You can see a bench and a maple leaf here.
In Rock Garden East you can see a rake.
>(Testing.)
>[1] get rake
(first heading east)
Rock Garden East
You can see a rake here.
In Rock Garden West you can see a bench and a maple leaf.
Taken.
>[2] drop rake
Dropped.
>[3] sit on bench
(first heading west)
Rock Garden West
You can see a bench and a maple leaf here.
In Rock Garden East you can see a rake.
You get onto the bench.
>[4] get rake
(first heading east)
(first getting off the bench)
Rock Garden East
You can see a rake here.
In Rock Garden West you can see a bench and a maple leaf.
Taken.
You can see a bench and a maple leaf here.
In Rock Garden East you can see a rake.
>(Testing.)
>[1] get rake
(first heading east)
Rock Garden East
You can see a rake here.
In Rock Garden West you can see a bench and a maple leaf.
Taken.
>[2] drop rake
Dropped.
>[3] sit on bench
(first heading west)
Rock Garden West
You can see a bench and a maple leaf here.
In Rock Garden East you can see a rake.
You get onto the bench.
>[4] get rake
(first heading east)
(first getting off the bench)
Rock Garden East
You can see a rake here.
In Rock Garden West you can see a bench and a maple leaf.
Taken.