Swerve left? Swerve right? Or think about it and die?

Example 232

Building a marble chute track in which a dropped marble will automatically roll downhill.

Suppose we have marbles that roll downhill across our map, in a life-size version of one of those marble-chute toys. We might now want to keep track of both compass relationships and which-room-slopes-into-which, so we make a new relation:

"Swerve left? Swerve right? Or think about it and die?"
Overlooking relates various rooms to various rooms.
The verb to overlook means the overlooking relation.
A thing can be spherical or lumpy. A marble is a kind of thing. A marble is always spherical. The player carries a marble called a red marble. The player carries a marble called an agate marble. The player carries a marble called a blue cloudy marble.
The Long Yellow Slide is north of the Funnel. The Long Yellow Slide overlooks the Blue Funnel. The Ski-jump is below the Blue Funnel. The Blue Funnel overlooks the Ski-jump. The Ski-jump overlooks the Landing Bowl. The Landing Bowl overlooks the Snake Run. The Landing Bowl is north of the Snake Run. The Snake Run overlooks the Goal. The Snake Run is north of the Goal.
Definition: a room is sloping if it overlooks a room.

And let's say we want the player to be allowed to slide, too, since that would be much more fun than just watching the marbles go:

Understand "sit" as sitting down. Sitting down is an action applying to nothing. Check sitting down: if the player is spherical, say "You are already seated." Carry out sitting down: now the player is spherical. Report sitting down: say "You sit, ready to slide wherever fate takes you."
Understand the command "stand" as something new.
Understand "stand" or "stand up" as standing up. Standing up is an action applying to nothing. Check standing up: if the player is lumpy, say "You are already standing." Carry out standing up: now the player is lumpy. Report standing up: say "You get to your feet."

Now a rule to control what happens to all our sliding and rolling objects:

Every turn:
   repeat with item running through spherical things which are in sloping rooms:
      let the current space be the holder of the item;
      let the final space be a random room which is overlooked by the current space;
      if the player can see the item and the item is a marble, say "[The item] rolls out of the room toward [the final space].[line break]";
      if the player is the item, say "You keep sliding...";
      move the item to the final space;
      if the player can see the item and the item is a marble, say "[The item] rolls into the room from [the current space].[line break]".

Since the Ski-jump overlooks the Landing Bowl, the marble will be able to fly through the air to its destination, even though there is no map connection to allow the player to cross. We might want to let the player make it across this barrier also, so:

Instead of jumping in a sloping room:
   say "You leap...";
   move the player to a random room overlooked by the location.

Because overlooking is various-to-various, we could include that element popular in marble chute toys, the splitter:

The Downhill Splitter is north of the Long Yellow Slide. "The green plastic chute runs downhill towards a Y-junction, forcing incoming marbles right or left."
The Downhill Splitter overlooks the Long Yellow Slide and the Purple Snaking Passage. The Purple Snaking Passage is southeast of the Downhill Splitter. The Purple Snaking Passage overlooks the Landing Bowl. The Purple Snaking Passage is above the Landing Bowl.
The player is in the Downhill Splitter.
Test me with "drop red / drop blue / sit / z / stand up / drop agate / sit / z / z / z / z / z".
Test me with "drop red / drop blue / sit / z / stand up / drop agate / sit / z / z / z / z / z".
Downhill Splitter
The green plastic chute runs downhill towards a Y-junction, forcing incoming marbles right or left.

>(Testing.)

>[1] drop red
Dropped.

The red marble rolls out of the room toward the Purple Snaking Passage.

>[2] drop blue
Dropped.

The blue cloudy marble rolls out of the room toward the Long Yellow Slide.

>[3] sit
You sit, ready to slide wherever fate takes you.

You keep sliding...

Purple Snaking Passage

>[4] z
Time passes.

You keep sliding...

Landing Bowl

>[5] stand up
You get to your feet.

The blue cloudy marble rolls into the room from the Ski-jump.

>[6] drop agate
Dropped.

The agate marble rolls out of the room toward the Snake Run.
The blue cloudy marble rolls out of the room toward the Snake Run.

>[7] sit
You sit, ready to slide wherever fate takes you.

You keep sliding...

Snake Run
You can see a blue cloudy marble and an agate marble here.

The agate marble rolls out of the room toward the Goal.
The blue cloudy marble rolls out of the room toward the Goal.

>[8] z
Time passes.

You keep sliding...

Goal
You can see a blue cloudy marble, an agate marble and a red marble here.

>[9] z
Time passes.

>[10] z
Time passes.

>[11] z
Time passes.

>[12] z
Time passes.