Inform 7 Home Page / Documentation
§8.16. Counting the number of things
It is very often useful to know how many things are in a given situation, and for this purpose we have the "number of ..." construction. For instance:
the number of edible things carried
the number of things on the table
the number of people in the Dining Room
Whereas "a woman is holding an animal" makes the same test as "an animal is held by a woman", getting the same result, counting is not so even-handed:
the number of women holding animals
the number of animals held by women
are different questions and, unless the ration is strictly one lapdog per baroness, will have different answers. If Cruella de Vil has 101 dalmatians, they may be very different indeed.
It can also be helpful to count things with no particular location, like so:
the number of rooms
the number of closed doors
When play begins:
now the right hand status line is "Explored: [number of visited rooms]/[number of rooms]".
Provided that the possible range is finite, we can also use "number of" to count values which match a description. For instance:
the number of non-recurring scenes
or if we were to define
Colour is a kind of value. The colours are red, orange, yellow, green, blue, indigo and violet.
then "the number of colours" would evaluate to 7. As with other ways of talking about whole ranges of values, this only works if the range is manageable. "The number of numbers" cannot sensibly be worked out: there are infinitely many, for all practical purposes, and similarly for "the number of texts".