Tiny Garden
Example 62
★★Sometimes we want to make a list of something too complicated to express in a say list… phrase. When this happens, we can instead mark all the items we want to mention as "marked for listing".
In this case, we have a lawn area made up of four rooms. We want each room to automatically describe the directions leading to the other parts of the lawn. To do this, we will first determine which directions are relevant and mark those for listing, then list them.
"Tiny Garden"
The Herb Garden is a room. "Along this side of the house run your great-aunt's herb beds."
A Grassy Room is a kind of room. The printed name of a Grassy Room is usually "Lawn". The description of a Grassy Room is "The grass underfoot is thick and green. The lawn extends to [grassy directions] from here."
The following phrase goes through all the directions in the compass and marks the ones that are interesting to us at the moment.
To say grassy directions:
repeat with that way running through directions:
if the room that way from the location is a grassy room,
now that way is marked for listing;
say "[a list of directions which are marked for listing]";
now every direction is not marked for listing.
Lawn1 is west of the Herb Garden. It contains a picnic table and a wicker basket. Lawn2 is south of Lawn1 and southeast of Lawn4. Lawn3 is southwest of Lawn1, west of Lawn2, and south of Lawn4. Lawn4 is west of Lawn1. Lawn4 contains a birdbath. The birdbath is fixed in place.
Lawn1, Lawn2, Lawn3, and Lawn4 are Grassy Rooms.
Test me with "w / s / w / n".
Test me with "w / s / w / n".
Herb Garden
Along this side of the house run your great-aunt's herb beds.
>(Testing.)
>[1] w
Lawn
The grass underfoot is thick and green. The lawn extends to the south, the southwest and the west from here.
You can see a picnic table and a wicker basket here.
>[2] s
Lawn
The grass underfoot is thick and green. The lawn extends to the north, the northwest and the west from here.
>[3] w
Lawn
The grass underfoot is thick and green. The lawn extends to the north, the northeast and the east from here.
>[4] n
Lawn
The grass underfoot is thick and green. The lawn extends to the south, the southeast and the east from here.
You can see a birdbath here.
Along this side of the house run your great-aunt's herb beds.
>(Testing.)
>[1] w
Lawn
The grass underfoot is thick and green. The lawn extends to the south, the southwest and the west from here.
You can see a picnic table and a wicker basket here.
>[2] s
Lawn
The grass underfoot is thick and green. The lawn extends to the north, the northwest and the west from here.
>[3] w
Lawn
The grass underfoot is thick and green. The lawn extends to the north, the northeast and the east from here.
>[4] n
Lawn
The grass underfoot is thick and green. The lawn extends to the south, the southeast and the east from here.
You can see a birdbath here.