| 9.5. Dice and Playing Cards |
Most toys are single things, and no harder to create than any other small items, but games often require a multitude of tokens to be combined, and this can be logistically tricky.
The classic example is a pack of playing cards, where the player must individually control 52 items but without fussy commands or verbose text being printed back. Jokers Wild provides a simple "one card at a time" approach; Tilt 1 is more sophisticated, with 52 independently accessible cards; Tilt 2 can further judge the value of a selection of cards - the ranking of a poker hand.
Drawing cards from a shuffled pack is only one source of randomness. Games of chance also involve items drawn from a bag: Wonka's Revenge provides just such a lottery. More often, dice are thrown. A single die is easy enough:
The die is carried by the player. After dropping the die: say "It lands with [a random number from 1 to 6] uppermost." Understand "roll [something]" as dropping.
Quick, but not very good. Most dice games involve rolling more than one die at a time, to get a more interesting distribution of outcomes: they may also involve special rules applying to doubles, for instance. See Do Pass Go.
See Typography for on-screen notations for chess and card games
"Wonka's Revenge"
The Caribou Lodge is a room. "Hundreds of expectant faces are turned your way from every table." A lottery drum is in the Lodge. "Before you is the lottery drum[if we have spun the drum], ready to disgorge a ticket[otherwise], waiting to be spun[end if]." In the drum are a red ticket, an orange ticket, a yellow ticket, a green ticket, a blue ticket, a purple ticket, and a ticket of pure gold. The drum is closed and openable.
Understand "spin [something]" as spinning.
Spinning is an action with past participle spun, applying to one thing.
Check spinning: if the noun is an open container which contains something, say "[The list of things in the noun] would fly out." instead.
Carry out spinning a container:
shuffle the contents of the noun.
Report spinning:
if the noun contains something, say "You rattle [if the noun is transparent][the list of things in the noun][otherwise]the stuff[end if] in [the noun].";
otherwise say "Nothing results of your shaking [the noun]."
Inform keeps track of the order in which things have been put into a container. If we want to change that order without the player's intervention, we can move the things ourselves.
To shuffle the contents of (basket - a container):
let moves be the number of things in the basket;
repeat with counter running from 1 to moves:
move a random thing in the basket to the basket.
After opening the drum when we have spun the drum for the first time:
if something (called the pick) is in the drum:
try searching the drum;
say "[The pick] it is, then.";
silently try taking the pick;
if the pick is the ticket of pure gold, end the story finally;
otherwise end the story saying "Oh well, better luck next time."
Test me with "open drum / look in drum / close drum / spin drum / open drum".
|
| Example Do Pass Go A pair of dice which can be rolled, and are described with their current total when not carried, and have individual scores when examined. | |