Inform 7 Home Page / Documentation


§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


arrow-up.png Start of Chapter 9: Props: Food, Clothing, Money, Toys, Books, Electronics
arrow-left.png Back to §9.4. Money
arrow-right.png Onward to §9.6. Reading Matter

*ExampleDo 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.

*ExampleWonka's Revenge
A lottery drum which redistributes the tickets inside whenever the player spins it.

**ExampleJokers Wild
A deck of cards which can be shuffled and dealt from.

***ExampleTilt 1
A deck of cards with fully implemented individual cards, which can be separately drawn and discarded, and referred to by name.

***ExampleTilt 2
A deck of cards with fully implemented individual cards; when the player has a full poker hand, the inventory listing describes the resulting hand accordingly.