Inform 7 Home Page / Documentation
§9.4. Money
Money could be anything which the two people in a bargain both agree is valuable. Here, the player and an ogre agree on a copper coin as money:
The player carries a copper coin. The ogre carries a rock cake. The cake is edible.
Instead of giving the coin to the ogre:
now the ogre carries the coin;
now the player carries the cake;
say "The ogre grunts and hands you a rock cake."
Now Inform does provide an action, "buying", and a command for it, BUY, but they ordinarily respond simply "Nothing is on sale." This is no longer true, so we should make BUY CAKE work. The difficulty here is that a command like BUY CAKE does not specify what should be handed over in exchange. Here we just check that the player has the coin, but in principle we could check for any of a range of monetary tokens - coins, notes, cheque book, debit card, and so on.
Instead of buying the cake:
if the player has the coin, try giving the coin to the ogre;
otherwise say "You have no money."
In more advanced economies, where shopping replaces barter, the seller will stock a wide range of differently priced goods. For a tabulated catalogue of wares, see Introduction to Juggling: to allow the player to negotiate prices, see Money for Nothing. In both of those examples, the player's current financial worth is simulated only as a current total amount of money carried - say, $2.50. This is typical, because in most situations what matters is how much money is in the pocket, not how it is made up. Money behaves more like a liquid than a set of items: hence terms like "liquidity", "cash flow" or Frozen Assets - the name of the simplest example demonstrating this. If we really need a comprehensive simulation down to pieces of currency - where it makes a difference carrying four quarters rather than a dollar bill, because the quarters can be fed into a vending machine - see Nickel and Dimed.
Fabrication takes the problem in a different direction, making calculations about the cost of a new garment based on the price of the pattern, the quantity of fabric required, and the value of the fabric type chosen -- showing off what we can do with unit multiplication in Inform.
Widget Enterprises explores the challenge of pricing widgets for maximum profit, given certain necessary costs and customers with varying willingness to pay.
See Actions on Multiple Objects for an implementation of giving that allows the player to offer multiple objects at once, where their combined value determines whether they are accepted
Start of Chapter 9: Props: Food, Clothing, Money, Toys, Books, Electronics | |
Back to §9.3. Clothing | |
Onward to §9.5. Dice and Playing Cards |
ExampleWidget Enterprises |
Suppose the player is responsible for pricing at Widget Enterprises. Widget production entails a certain fixed cost as well as a cost per unit; and somewhere out in the world there are a number of customers interested in purchasing widgets, but the player starts without knowing what this distribution looks like.
We can express the profits as an equation: the total made by selling widgets, minus the cost thereof.
The Table of Customers holds the data about customer preferences, and whenever the player selects a widget price, we consult it to determine how many customers in total would be willing to buy at that price.
A monetary value is a kind of value. $1.99 specifies a monetary value with parts dollars and cents.
Equation - Profit Equation
P = nV - (F + nC)
where P is a monetary value, F is the fixed cost, C is the unit cost, V is a monetary value, and n is a number.
The fixed cost is a monetary value that varies. The fixed cost is $5.00.
The unit cost is a monetary value that varies. The unit cost is $10.66.
base |
maximum value |
2 |
$26.00 |
5 |
$20.00 |
8 |
$15.00 |
2 |
$13.50 |
1 |
$9.00 |
To decide what number is the units sold at (V - a monetary value):
let total units be 0;
repeat through the Table of Customers:
if V is less than the maximum value entry:
increase total units by the base entry;
decide on total units.
Understand "set price to [monetary value]" as setting price to. Setting price to is an action applying to one monetary value.
Carry out setting price to:
let V be the monetary value understood;
let n be the units sold at the monetary value understood;
let P be given by the Profit Equation;
say "You set the price of your widgets to [V], resulting in sales of [n] unit[s] and ";
if P is less than $0.00:
let L be $0.00 - P;
say "a loss of [L].";
otherwise if P is $0.00:
say "break even.";
otherwise:
say "a profit of [P].".
Test me with "set price to $0.00 / set price to $100.00 / set price to $15.00 / set price to $8.00 / set price to $25.00 / set price to $14.99".
As written this will be a rather dull guessing game for the player; more interesting would be to enhance it into a fuller economic simulator with more control over fixed costs and customer price points.
ExampleFrozen Assets |
In our brave new world, everything will have a price, so we had better spell this out.
Price is a kind of value. $10.99 specifies a price. A thing has a price. The price of a thing is usually $0.00. After examining something for sale, say "It can be yours for [the price of the noun]."
Now we assume a simple shopping model in which the player can't take anything without paying for it.
Definition: a thing is free if the price of it is $0.00.
Definition: a thing is for sale if it is not free.
Instead of taking something for sale:
say "You'll have to pay for that."
Before buying something for sale when the money is not in the wallet:
say "You're broke." instead.
Before buying something for sale when the money is free:
say "You're broke." instead.
Before buying something for sale when the price of the money is less than the price of the noun:
say "Your funds do not run to the price of [the noun]." instead.
Instead of buying something:
decrease the price of the money by the price of the noun;
say "You fork over [the price of the noun] for [the noun], leaving yourself with [the price of the money].";
if the money is free:
now the money is nowhere;
now the price of the noun is $0.00;
now the player is carrying the noun.
The player's money object is going to be a bit unusual, because it has value but cannot itself be bought.
The player carries a wallet. The wallet contains money. The price of the money is $4.50. The printed name of the money is "[price of the money] in cash". Understand "cash" as the money.
Instead of taking the money:
say "Best to leave it alone until you need to buy something."
Instead of buying something free:
say "[The noun] is yours already."
Instead of buying the money:
say "The money belongs to you; you buy things with it."
Now we just need something to buy.
The Dessert Parlor is a room. "An underlit, over-crowded room campily furnished with a lot of gilt-frame mirrors and twinkle lights: it is essentially a brothel of food. The service is slow at best, and on Saturday nights glacial. However. The wares on display more than make up for these trivial inconveniences."
The vanilla ice cream is an edible thing in the Parlor. The price of the ice cream is $2.45. The description is "In the scale of ice creams, you recognize this as a very inferior vanilla because it has no adjectives in the title."
The raspberry tart is an edible thing in the Parlor. The price of the tart is $4.50. The description is "An almond-laced shell packed with raspberries-under-glaze."
The syllabub is an edible thing in the Parlor. The price of the syllabub is $4.25. The description is "Whipped cream, alcohol, and lime juice, a substance without any redeeming food value whatever."
The espresso cake is an edible thing in the Parlor. The price of the espresso cake is $5.50. The description is "A lethal wedge of purest blackness."
Test me with "inventory / examine syllabub / get syllabub / buy syllabub / drop it / get it / buy raspberry tart".
Implementing caloric units for this scenario is left as an exercise for the reader.
ExampleMoney for Nothing |
Price is a kind of value. $10.99 specifies a price with parts dollars and cents (optional, preamble optional).
A person has a price called wealth. The wealth of the player is $15.
A thing has a price called minimum value. The minimum value of a thing is usually $0.50.
A thing has a price called desired value. The desired value of a thing is usually $5.00.
Offering it for is an action applying to one price and one visible thing.
Understand "offer [price] for [something]" as offering it for.
After taking inventory, say "You have [the wealth of the player]."
Check offering it for:
if the price understood is greater than the wealth of the player, say "You don't have that kind of cash." instead;
if the second noun is not carried by someone, say "There's no one in a position to sell you [the second noun]." instead;
if the second noun is carried by the player, say "[The second noun] is already yours." instead;
if the minimum value of the second noun is greater than the price understood, say "[The holder of the second noun] cackles disdainfully. 'If yer just here to insult me you can take your business elsewhere!' he says." instead;
if the desired value of the second noun is greater than the price understood:
let difference be the desired value of the second noun minus the price understood;
let difference be difference divided by two;
decrease the desired value of the second noun by difference;
now the last object offered is the second noun;
say "'How about [desired value of the second noun]?' suggests [the holder of the second noun]." instead;
otherwise:
unless the desired value of the second noun is the price understood:
say "From the avaricious gleam in the eye of [the holder of the second noun], you guess you could've gotten this purchase for less..."
Carry out offering it for:
increase the wealth of the holder of the second noun by the price understood;
decrease the wealth of the player by the price understood;
move the second noun to the player.
Report offering it for:
say "You spend [the price understood], and now you possess [the second noun]."
When play begins: now right hand status line is "Your funds: [wealth of the player]".
Now, since the man does make counter-offers, it would be reasonable to let the player accept or reject those, as well:
Instead of saying yes when the last object offered is carried by a person (called seller) who is not the player:
if the seller is not visible:
continue the action;
otherwise:
now the price understood is the desired value of the last object offered;
try offering the desired value of the last object offered for the last object offered.
Instead of saying no when the last object offered is carried by a person (called seller) who is not the player:
if the seller is not visible:
continue the action;
otherwise:
now the last object offered is the player;
say "You reject the offer firmly."
And we borrow just a line or two from a later chapter to take care of some alternate syntax the player might try:
Understand "offer [price] to [someone]" as a mistake ("You'll need to specify what you want to buy -- try OFFER $1000.00 FOR BROOKLYN BRIDGE."). Understand "offer [someone] [price]" as a mistake ("You'll need to specify what you want to buy -- try OFFER $1000.00 FOR BROOKLYN BRIDGE.").
Understand "buy [something]" as a mistake ("You'll have to name your price: try OFFER $1000.00 FOR BROOKLYN BRIDGE.").
The Flea Market is a room. The crotchety man is a man in the Market. "A crotchety man here is selling [the list of things carried by the crotchety man]." The crotchety man carries a broken television set, a Victorian rhinestone brooch, and a cracked shaving mug.
Test me with "offer $0.50 for mug / offer $0.50 to man / offer $6.00 for mug / offer $50.00 for brooch / offer $1.50 for brooch / offer $4.50 for brooch / no / offer $4.50 for brooch / yes".
ExampleFabrication |
When we make a new kind of value, the new named values can themselves have properties. That is convenient because, for instance, we might want to associate a material (itself the property of an object) with certain features, such as price.
A material is a kind of value. The materials are silk, velvet, cotton, and wool.
Cost is a kind of value.. $1.99 per sq yard specifies a cost. A cost times an area specifies a price.
The cost of silk is usually $5.75 per sq yard. The cost of velvet is usually $9.50 per sq yard. The cost of cotton is usually $2.29 per sq yard. The cost of wool is usually $4.75 per sq yard.
A pattern is a kind of thing. A pattern has a material. A pattern has an area. A pattern has a price. The price of a pattern is usually $9.99. Understand "pattern" as a pattern. Understand "patterns" as the plural of a pattern.
After printing the name of a pattern:
if planning:
do nothing;
otherwise:
say " pattern".
To decide what price is the material price of (chosen item - pattern):
let C be the cost of the material of the chosen item;
let A be the area of the chosen item;
decide on C * A.
To decide what price is the overall price of (chosen item - pattern):
let P be the price of the chosen item;
let M be the material price of the chosen item;
decide on P + M.
Planning it for is an action applying to one material and one thing.
Carry out planning it for:
now the material of the second noun is the material understood.
Report planning it for:
say "You lay plans for a [material understood] [second noun], running [material price of the second noun] for materials and [price of the second noun] for the pattern itself, for a total of [overall price of the second noun]."
Joanne's Fabrics is a room. Joanne's Fabrics contains a pattern bin.
The cape is a pattern. The material of the cape is velvet. The area of the cape is 9 sq yards.
The bodice is a pattern. The material of the bodice is silk. The area of the bodice is 2 sq yards. The price of the bodice is $11.99.
Test me with "plan silk bodice / plan velvet bodice / plan velvet cape / plan wool cape".
ExampleNickel and Dimed |
Typically games which keep track of the player's wealth need only do so as an abstract number, but occasionally it becomes useful to represent money as physical coins and bills. Here is an example that does exactly that:
Price is a kind of value. $10.99 specifies a price with parts dollars and cents. A thing has a price. The price of a thing is usually $0.00.
A dollar bill is a kind of money. The price of a dollar bill is $1.00. The printed name of a dollar bill is "dollar bill". Rule for printing the plural name of a dollar bill: say "dollar bills". The description of a dollar bill is "It has George Washington's head on the front, which with a bit of creative folding can be scrunched to look like a mushroom. All important things really are learned in kindergarten."
A five-dollar bill is a kind of money. The price of a five-dollar bill is $5.00. Understand "five" or "five dollar" as the five-dollar bill. The description of a five-dollar bill is "Abraham Lincoln. He looks slightly less dignified here than he does on the penny."
A hundred-dollar bill is a kind of money. The price of the hundred-dollar bill is $100.00. Understand "hundred" or "hundred dollar" as the hundred-dollar bill. Understand "dollar" as the dollar bill. The description of a hundred-dollar bill is "It's got Benjamin Franklin, who always gets shafted: a denomination too large for anyone to carry conveniently, and a lot of local fame in Philadelphia."
Our choice of understand rules guarantees that "five dollar" will be understood as the five, but "dollar" alone as the single. We will learn more about "understand" in later chapters, but here is a test to check the functionality:
Test bills with "x hundred dollar bill / x five dollar bill / x hundred / x five / x dollar / x dollar bill".
A quarter is a kind of coin. The price of a quarter is $0.25. The description of a quarter is "One of the old-fashioned variety, not a state quarter."
A dime is a kind of coin. The price of a dime is $0.10. The description of a dime is "Franklin Roosevelt, trying not to look too annoyed that his coin is so small and thin."
A nickel is a kind of coin. The price of a nickel is $0.05. The description of a nickel is "A chubby coin, but you've always liked Thomas Jefferson, and the Monticello on the back is a nice touch."
A penny is a kind of coin. The price of a penny is $0.01. The description of the penny is "A profile of Abe Lincoln. Sometime soon they'll stop minting these, you're sure of it."
Ownership relates one person (called the owner) to various things. The verb to own means the ownership relation.
Instead of buying something which is owned by the player:
say "You already own [the noun]."
Instead of going somewhere when the player encloses something (called the stolen goods) which is not owned by the player:
if the owner of the stolen goods is not a person:
now the player owns the stolen goods;
continue the action;
if the owner of the stolen goods can see the player,
say "'Hey there buddy, not so fast,' says [the owner of the stolen goods]. 'You going to buy [the stolen goods] first, or am I gonna call the cops?'";
otherwise continue the action.
After taking inventory:
say "Altogether, you've got [the player's cash] on your person."
To decide what price is the player's cash:
let sum be the total price of money enclosed by the player;
decide on sum.
To decide what price is the sum in (item - a container):
let sum be the total price of the money in the item;
decide on sum.
When play begins: now every thing carried by the player is owned by the player.
Definition: a thing is worthless if the price of it is $0.00. Definition: a thing is valuable if it is not worthless.
Rule for printing room description details of something (called target) which is for sale (this is the disclose prices in room description rule): say " ([price of the target])".
Before listing contents: group money together giving articles.
Instead of examining a for sale thing (this is the describe things by price rule):
say "[The noun] costs [the price of the noun], payable to [the owner of the noun]."
The cashbox is a theoretical construct, not something the player will ever encounter in the course of the game. It contains all the money that is available for non-player characters to use in making change. If we wanted, we could give each character his own stash of change, but this would increase the likelihood that any given person would run out of cash to make change with. (And in this example there is only one vendor anyway.)
The cashbox is a container. The cashbox contains 10 pennies. The cashbox contains 10 nickels. The cashbox contains 10 dimes. The cashbox contains 10 quarters. The cashbox contains 10 dollar bills. The cashbox contains 10 five-dollar bills.
The block buying rule is not listed in the check buying rules.
Check buying something:
if the noun is not for sale, say "[The owner of the noun] does not want to sell you [the noun]." instead;
if the player's cash is less than the price of the noun, say "You can't afford the asking price of [the price of the noun] for [the noun]." instead.
Carry out buying something:
let sum paid be $0.00;
while sum paid is less than the price of the noun:
let current target be the price of the noun minus the sum paid;
let bill offered be the best money from the player for the current target;
if the bill offered is money:
move the bill offered to the owner of the noun;
now the bill offered is spent;
increase the sum paid by the price of the bill offered;
let current target be the price of the noun minus the sum paid;
say "You hand [the owner of the noun] [a list of spent money]. [run paragraph on]";
let change be $0.00;
if the sum paid is greater than the price of the noun:
now the change is the sum paid minus the price of the noun;
if change is greater than the sum in the cashbox:
now the player carries every spent money;
now every spent thing is fresh;
say "'Whoa,' says [the owner of the noun], handing the cash back to you. 'I can't make change for that, man, sorry.'" instead;
now every spent thing is in the cashbox;
now every spent thing is fresh;
while change is greater than $0.00:
let change bill be the best money from the cashbox for change;
decrease change by the price of the change bill;
now change bill is spent;
move change bill to player;
if money is spent, say "[The owner of the noun] makes change with [a list of spent money]. [run paragraph on]";
now every spent thing is fresh;
if the noun is not enclosed by the player and the owner of the noun can touch the noun:
say "'Here ya go,' says [the owner of the noun], handing [the noun] to you. [run paragraph on]";
move the noun to the player;
now the player owns the noun.
Report buying something:
if the player owns the noun,
say "Your transaction is now complete, leaving you with [the player's cash]."
We've skipped over defining what makes a denomination the best for a given transaction, so we'd better do that now. Our goal is to avoid ever having the player gratuitously overpay -- he should always offer the smallest amount of money that will meet the price of what he's buying.
We also assume that all money "enclosed by the buyer" -- that is, somewhere in the buyer's possession -- is available for use. This might not be true in a game where the player could pick up, say, a sealed lucite container with a ten-dollar bill inside; in that case we would have to define our terms more rigorously, perhaps by requiring that the bills be both enclosed and touchable by the buyer. The touchability check adds an extra layer of calculation, however, and since it is not necessary in this example (and probably not in most other cases either), we'll leave it out:
Definition: money is costly if its price is $2.50 or more. Definition: money is cheap if its price is $0.99 or less.
Functional relation is a kind of value. The functional relations are overpayment, underpayment and irrelevant. Money has a functional relation.
To decide what money is the best money from (buyer - a thing) for (cost - a price):
repeat with bill offered running through money:
if the bill offered is enclosed by the buyer:
if the price of the bill offered is the cost, decide on the bill offered;
if the price of the bill offered is greater than the cost, now the functional relation of bill offered is overpayment;
otherwise now the functional relation of the bill offered is underpayment;
otherwise:
now the functional relation of the bill offered is irrelevant;
[say "underpayment: [a list of underpayment money]
overpayment: [a list of overpayment money]";]
if the total price of underpayment money is less than the cost:
decide on the cheapest money which is overpayment;
otherwise:
decide on the costliest money which is underpayment.
Notice the "say underpayment/overpayment section..." noted out, above. This is for debugging purposes: when writing complex code, it is sometimes useful to put in lines that will say explicitly what is going on. We can enclose them in brackets and Inform will ignore them as though they were comments; if we run into any problems with the code later, we can erase the brackets and see the diagnostic printed to the screen as we play.
Instead of giving money to someone:
say "Best to keep the transaction simple by buying whatever you want."
The player carries 2 dollar bills. The player carries a nickel. The player carries 2 pennies. The player carries a five-dollar bill. The player carries 1 hundred-dollar bill.
The Bitterly Cold Street is north of the Subway Station. "Even though there is no actual snow or ice, the street is about as cold as you can stand, for which reason walking the twenty blocks uptown is not an acceptable option." The Bitterly Cold Street contains a dollar bill.
The newspaper man is a man in the Subway Station. "A newspaper man in a knit cap and fingerless gloves is hopping up and down behind his stand[if the turn count is 1]. Cold weather, caffeine overdose, or mental illness? You may never know. Welcome to New York[end if]." The description is "Eye contact with strangers is something to avoid around here."
The stand is a supporter in the Station. The stand is scenery.
A copy of the New York Times is on the stand. The price of the New York Times is $1.25.
A pack of gum is on the stand. The price of the gum is $0.40.
A paperback novel is on the stand. The price of the paperback novel is $7.99.
A packet of trading cards is on the stand. The price of the packet is $0.99.
When play begins:
now every thing on the stand is owned by the newspaper man;
now every thing on the stand is for sale.
We could have done all that by hand, but the initialization requires a little less work.
The ticket machine is a container in the Subway Station. It is fixed in place. The description of the ticket machine is "An LED screen on the front instructs you to insert [remaining ticket total] to complete your purchase. You also notice that the NO CHANGE light is lit up." The light is part of the ticket machine. The printed name of the light is "no change light". Understand "no change" or "no change light" as the light.
The description of the light is "In the whole of your recollection, the ticket machine has actually had change a total of twice. Usually, as now, the no-change light gleams angrily, daring you to put in more than you owe." A cash return button is part of the ticket machine. Instead of pushing the cash return button: say "The ticket machine regurgitates [the list of things in the ticket machine]."; now every thing in the ticket machine is carried by the player. Instead of taking something which is in the ticket machine: say "The ticket machine has swallowed your money, but it can be retrieved (you hope) with the cash return button."
Instead of inserting a hundred-dollar bill into the ticket machine:
say "What, are you nuts?"
To decide what price is the remaining ticket total:
let absolute cost be $2.25;
let remaining cost be absolute cost minus the total price of things in the ticket machine;
if remaining cost is less than $0.00, decide on $0.00;
decide on remaining cost.
Instead of inserting something which is not money into the ticket machine: say "The ticket machine only accepts money, not other tokens of your esteem and regard."
Instead of inserting a penny into the ticket machine:
say "The penny rattles out again mockingly: not even the ticket machine thinks these are worth anything."
A subway pass is a kind of thing. 15 subway passes are in the cashbox. The description of a subway pass is usually "A rectangle of thick lavender paper with a black magnetic stripe running up the back side. It is good for one trip on the subway."
After inserting something into the ticket machine:
if the remaining ticket total is $0.00:
let purchased ticket be a random subway pass in the cashbox;
if purchased ticket is not a subway pass, say "The ticket machine grunts disobligingly and then the unwelcome word MALFUNCTION parades across the LED screen, three letters at a time." instead;
repeat with item running through things in the machine:
now the item is nowhere;
move purchased ticket to player;
say "The ticket machine beeps obligingly and disgorges a single subway pass.";
otherwise:
say "The ticket machine beeps obligingly and adjusts its price down to [remaining ticket total]."
And because even though the ticket machine is a container, we don't want to say (empty) after it in the room description:
Rule for printing room description details of the ticket machine:
do nothing instead.
After all that, we should probably give the player a chance to win, as well:
The turnstile is south of the Subway Station. "A turnstile is all that separates you from the subway platform stairs." The turnstile is north of the Platform. The turnstile is a door. Before going down in the presence of the turnstile, try going south instead. The turnstile is openable. The turnstile is open.
Instead of going through the turnstile when the player carries a subway pass: say "You enter the turnstile and begin your journey uptown..."; end the story finally saying "At last". Instead of going through the turnstile: say "You can't go through the turnstile without a subway pass. They're very strict about this."
Instead of inserting money into the turnstile: say "The turnstile takes passes, not money." Instead of inserting a subway pass into the turnstile, try entering the turnstile.
Test more with "buy times / put all but five-dollar bill in machine / press button / buy gum / buy cards / i / put dollar in machine / g / put quarter in machine / i / d".
In fairness to the Metropolitan Transit Authority, we should admit that most of the ticketing machines in the real New York subway are better than this, and will accept, say, a debit card. But that would be so much less exciting to implement.
ExampleIntroduction to Juggling |
Suppose we have a whole catalog-full of equipment that the player might want to purchase and use. We'll start by defining our purchasing rules:
We allow things to have prices, and the player's price to indicate how much money the player has:
Because we're allowing the player to order things that he can't currently see, we need to borrow a special kind of grammar from the Understanding chapter. All our orderable items in this example are toys, so "any toy" means any object of the toy kind, whether or not it is in view at the moment:
Understand "buy [any toy]" as ordering. Understand the command "order" as something new. Understand the command "order" as "buy".
Check ordering:
if the cost of the noun is greater than the price of the player, say "You only have [price of the player], while [the noun] would cost [cost of the noun]." instead.
Carry out ordering:
move the noun to the player;
decrease the price of the player by the cost of the noun.
Report ordering:
say "You order [a noun], which is delivered instantly."
We should also handle the situation where the player orders another of something he has already bought and which is right in front of him:
Instead of buying something:
say "You already have [a noun]."
So much for the general rules for this scenario. Now we move on to particulars: the actual items the player is allowed to order. Each item will have a description, a price, and a difficulty representing how skilled the player must be in order to make use of that item.
Since we are going to use price and difficulty in the table that defines our juggling equipment, we need to mention these kinds of value before the line that says how toys are defined.
Difficulty is a kind of value. The difficulties are easy, moderate, hard. The player has a difficulty. The difficulty of the player is easy.
The plural of toy is toys. A toy is a kind of thing. Some toys are defined by the Table of Juggling Equipment.
toy |
cost |
restriction |
description |
difficulty |
outcome |
an economy bounce ball set |
$10.00 |
"comes in set of three" |
"A fairly ordinary rubber ball, solid color." |
moderate |
"You create of the balls a cascade of moving color." |
an acrylic contact ball |
$14.00 |
"should be bought with ball polish" |
"A large clear ball, not for throwing but for using in various hand tricks." |
hard |
"You rotate the ball between your fingers and pass it over the backs of your hands." |
a UV-reactive contact ball |
$55.00 |
"appears to glow in dark rooms" |
"Similar to the ordinary acrylic contact ball, but UV-reactive." |
hard |
"The ball glows as it passes between your fingers and over the backs of your hands, rolls up to your wrist, snaps through the air-- all apparently of its own accord." |
a ball polish set |
$10.00 |
"useful only with acrylic contact balls" |
"Three bottles of polish and a rag for keeping acrylic contact balls scratch-free." |
hard |
"You juggle the polish bottles with difficulty, since they are full of sloshing liquid." |
a teaching beanbag set |
$8.00 |
"set of three" |
"Soft, easily-juggled bag." |
easy |
"You juggle the beanbags with basic competence." |
a stage ball set |
$13.50 |
"comes in set of three" |
"Not much different in appearance from the economy bounce ball, but larger so as to be visible from a stage." |
moderate |
"You create of the balls a cascade of moving color, visible from quite a distance." |
a fireball set |
$33.00 |
"will not be sold to minors" |
"A ball has wicking and a fuel-source inside so that it will burn while being juggled." |
hard |
"You juggle the fireballs rapidly, careful never to hold any of them a moment longer than necessary." |
Notice that we are allowed to define "description" and other already-known properties in the table as well.
Backstage is a room. "A muffled black room with felt on the floors and walls. A glowing sign over the stage door says SHOW IN PROGRESS."
Instead of examining the Catalog:
say "You read through the offerings, including: [paragraph break]";
repeat through Table of Juggling Equipment:
say "[bold type][toy entry][roman type]: [description entry] [cost entry], [restriction entry]. [paragraph break]".
When play begins:
now right hand status line is "Budget: [price of the player]";
now left hand status line is "[location], feeling [if the difficulty of player is easy]incompetent[end if][if the difficulty of player is moderate]moderately skilled[end if][if the difficulty of player is hard]highly skilled[end if]".
And of course this will be no fun unless the player is allowed to use the equipment:
Check juggling:
if the noun is not a toy listed in the Table of Juggling Equipment, say "You can't juggle [a noun]!" instead;
if the difficulty of the noun is greater than the difficulty of the player, say "You're not quite ready to juggle something like [the noun]. Better to start with an easier toy." instead.
Carry out juggling:
if a random chance of 1 in 3 succeeds:
if the difficulty of the player is less than hard and the difficulty of the player is the difficulty of the noun:
now the difficulty of the player is the difficulty after the difficulty of the player.
Report juggling:
say "[outcome of the noun][paragraph break]".
Instead of burning the fireball set:
say "It will flame by itself when you use it."
Test me with "read catalog / buy economy / buy beanbag / juggle economy / juggle beanbag / juggle beanbag / juggle beanbag / juggle beanbag / juggle beanbag / juggle beanbag / juggle economy / juggle economy / juggle economy / buy fireball set / juggle fireball".