| Chapter 14: Units |

| 14.2. Numbers

What Inform calls a "number" is a whole number in the range

> -32768, -32767, ..., -3, -2, -1, 0, 1, 2, 3, ..., 32767

We are allowed to perform the same operations on numbers as are provided by a typical four-function calculator: addition, subtraction, multiplication and division. We are allowed to write these either in words or in symbols:

> the score + 10
> 100 - the score
> 10 * 21
> 144 / 12
> the score plus 10
> 100 minus the score
> 10 times 21
> 10 multiplied by 21
> 144 divided by 12

If we use the symbols, then spaces around them are obligatory: really, they are words which just happen to be spelt with symbols instead of letters.

Division rounds down to the nearest integer (and we must never divide by 0, of course). If we try dividing 26 by 3, we will get the answer 8: but 3 does not go into 26 exactly. We can obtain the remainder, if we want to, like so:

> remainder after dividing 26 by 3

the value of which is 2, because 3 goes into 26 eight times, with remainder 2.

We can compare numbers using either the traditional computer-programming symbols, or using words:

> if the score is less than 10
> if the score < 10

and similarly for "greater than", "at least" and "at most", with the symbols ">", ">=" and "<=". But we are not allowed the equals sign: for that we need only use "is" -

> if the score is 10

Finally, as we have seen, numbers up to twelve may be written out, but larger ones must be written as numerals. So "twelve" or "12", but "13" only.

195
| Example Only You... Smoke which spreads through the rooms of the map, but only every other turn.

Suppose we want to have smoke that spreads from room to room, gradually filling the entire map with a clogging smoke. Having it spread every single turn would make for a pretty rapid diffusion, so we temper this by having it spread only on even-numbered turns, instead: "Only You..." Every turn when the turn count is even: if every room is smoky, make no decision; if location is unsmoky, let current state be 0; otherwise let current state be 1; repeat with area running through smoky rooms begin; now every room which is adjacent to the area is smoky; end repeat; if current state is 0 and the location is smoky, say "[The location] is filling rapidly with smoke." To decide whether the turn count is even: if the remainder after dividing the turn count by 2 is 0, yes; no. A room can be smoky or unsmoky. Some air is a backdrop. Air is everywhere. Instead of doing something other than examining or smelling to air: say "It's just air." Understand "smoke" as the air when the location is smoky. Instead of examining the air in a smoky room: say "A thick layer of smoke lies just under the ceiling." Instead of smelling the air in a smoky room: say "Agh, acrid." Instead of smelling a smoky room: try smelling the air. The Guide Lodge is a room. "A very spacious room capable of containing several hundred girls while they eat, talk, or do crafts. It is constructed in a not-unappealing rustic style, with floor-to-ceiling windows overlooking the lake below, and a fieldstone hearth at the center." The Guide Lodge is smoky After looking in a smoky room: say "A thick layer of smoke has gathered under the ceiling." The Kitchen is north of the Guide Lodge. "Multiple eight-burner ranges, ovens, and a walk-in refrigerator: you know the sort of thing." The Industrial Pantry is east of the Kitchen. "Awe-inspiring quantities of food line every shelf, from the three-gallon tub of mayonnaise to the 50-pound tub of rice. Perhaps the most astonishing item is a bag of marshmallows big enough to double as a futon." The player is in the Pantry. The Hallway is west of the Guide Lodge. The description of the Hallway is "A perpetually-crammed hallway which has to handle the overflow line for the toilets." A singed sign is fixed in place in the Hallway. The description of the sign is "Where the edge of the sign has not been burnt, the legible words are '...Can Prevent Forest Fires'." The Toilets are north of the Hallway. "Always in full use, at least when the 12-to-15s are here." The Coat Closet is south of the Hallway. "Muddy boots may not be worn inside the lodge; instead, about 250 pair are piled here, along with their owners' damp parkas and umbrellas." The Craft Supply Room is west of the Hallway. "A holding-depot for jugs of white glue and popsicle sticks." Test me with "x smoke / z / z / z / z / x smoke / look".

Previous | Contents | Next