Suppose we want to give the player a bag of candies, of which a random one is poisonous. We can pick which one should be poisoned at the start of play, like this:
"Candy"
The plural of piece of candy is pieces of candy. A piece of candy is a kind of thing. A piece of candy is always edible. Four pieces of candy are in the Halloween bag.
Toxicity is a kind of value. The toxicities are safe and poisonous. A piece of candy has a toxicity. A piece of candy is usually safe.
The Porch is a room. The player carries the Halloween bag.
After eating a poisonous piece of candy:
say "Oh, that didn't taste right at all. Oh well!"
When play begins:
now a random piece of candy is poisonous.
Test me with "eat candy / g / g / g".
All we need to do is select the player's destination for him at random:
"Zork II"
The Carousel Room is a room.
Instead of going from the Carousel Room:
move the player to a random adjacent room.
To avoid infringing the original game too much, let's try a somewhat different setting:
The Games of Chance is north of the Carousel Room. The Haunted Funhouse is northwest of the Carousel Room. The Ferris Wheel is east of the Carousel Room. The Topsy-Turvy is northeast of the Carousel Room. The Reproduction Henge is south of the Carousel Room. The Women's Toilet is southwest of the Carousel Room. The Men's Toilet is southeast of the Carousel Room. The Cotton Candy Shop is west of the Carousel Room.
Test me with "s".
And the following means that the test runs consistently even though the numbers are theoretically random. To make them truly random, remove this line.
When play begins, seed the random-number generator with 1234.
Or if we want to add the refinement that the Carousel Room can be switched off:
"Zork II"
The Carousel Room is a room. The spinning machine is a switched on device in the Carousel Room.
And then
Instead of going from the Carousel Room when the spinning machine is switched on:
move the player to a random adjacent room.
The Games of Chance is north of the Carousel Room. The Haunted Funhouse is northwest of the Carousel Room. The Ferris Wheel is east of the Carousel Room. The Topsy-Turvy is northeast of the Carousel Room. The Reproduction Henge is south of the Carousel Room. The Women's Toilet is southwest of the Carousel Room. The Men's Toilet is southeast of the Carousel Room. The Cotton Candy Shop is west of the Carousel Room.
Test me with "turn off machine / s / n / turn on machine / s".
When play begins, seed the random-number generator with 1234.