Simple example: Sometimes I find the use of a simple variable is the only way I can figure out how easily control certain actions.
The restaurant is a room.
The customer is a person in the restaurant.
The meal is in the restaurant. The meal is edible.
The money box is a container in the restaurant. The money box is locked.
The wages is in the money box.
x is a number that varies.
x is 1.
Instead of giving the meal to the customer:
say “well done, now you can get your wages.”;
now the customer carries the meal;
now x is 2.
If x is 1:
Now the money box is locked;
If x is greater than 1:
Now the money box is unlocked.
now the fuel-remaining of the lamp is -1;
now the lamp is not lit.
The Library is a room. “Thousands of books line the shelves. An old-fashioned lamp with a green lampshade sits on the table. Mounted on the wall beside the door is a light switch.”
The Library is dark.
Library darkness count is a number that varies. Library darkness count is 0.
The oak table is a supporter in the Library. The old lamp is on the table.
Rule for printing the description of a dark room:
if the location is the Library and the library darkness count is greater than 2:
say “At last, — as you grope around in the darkness, your fingers find a switch on the wall.”;
now the lamp is lit;
increase the library darkness count by 1;
say “It is pitch dark, and you can’t see a thing. Perhaps if you keep looking around in the dark you might find the light switch”.