10.5. Volume, Height, Weight

| Chapter 10: Physics: Substances, Ropes, Energy and Weight |

| 10.5. Volume, Height, Weight

What should fit into what? Inform has basically three sizes: small, person-sized, and room-sized. The difference between "small" and "person-sized" doesn't appear much, but it's the difference between an ordinary container and an enterable container; the fact that a person cannot get inside an ordinary container is one of the few size-related rules built into Inform. It will not object to, say, a fishing rod being put inside a matchbox.

Inform does have one built-in measure of the size of a container: its "capacity". This is a maximum number of contents:

> The capacity of the rucksack is 3.

This of course allows three anvils, while forbidding four postage stamps. To do better, we need units of measurement, and Dimensions demonstrates setting these up. The Speed of Thought, meanwhile, ventures into the area of unit conversion: having multiple types of unit and being able to express them to the player, or parse these in the player's input.

To be fully realistic in what will fit into what, we need sophisticated three-dimensional models of shapes, both of the items being carried and of the free space remaining inside containers. Depth elegantly simplifies this by approximating items as cuboids, with a given width, length and height: these multiply to give a volume. To fit in a container, a new item's volume must not exceed the volume remaining inside the container, and in addition its three dimensions must also fit in one of the possible arrangements at right angles to the sides. (So this system would indeed prevent a 1x1x100 fishing rod from being put inside a 5x2x1 matchbox, but would also prevent a 12x1x1 pencil from being put into a 10x10x1 box, because it would need to be turned diagonally to fit.)

Lead Cuts Paper provides a different constraint: here we do not let light-weight containers hold heavy objects.

Weight comes in a different way into Swerve left? Swerve right? Or think about it and die?, which exploits up/down map connections to work out which way gravity would take a rolling marble.

See Liquids for containers with liquid capacity

247
| Example Dimensions This example draws together the previous snippets into a working implementation of the weighbridge. |
WI

The following is not a very sophisticated approach, because it does not allow for weight to accumulate: if we put a gold ingot into a paper bag, then put the bag on the balance platform, only the bag's weight will register. But it will do for a first try. "Dimensions" A length is a kind of value. 10m specifies a length. An area is a kind of value. 10 sq m specifies an area. A length times a length specifies an area. A weight is a kind of value. 10kg specifies a weight. Everything has a weight. The verb to weigh (it weighs, they weigh, it is weighing) implies the weight property. A thing usually weighs 1kg. Definition: A thing is light if its weight is 3kg or less. Definition: A thing is heavy if its weight is 10kg or more. The Weighbridge is a room. A blackboard is in the Weighbridge. "A blackboard propped against one wall reads: '122/10 is [122 divided by 10] remainder [remainder after dividing 122 by 10]; 122kg/10kg is [122kg divided by 10kg] remainder [remainder after dividing 122kg by 10kg]; 122kg/10 is [122kg divided by 10] remainder [remainder after dividing 122kg by 10].'" The blackboard weighs 10kg. A feather and a lead pig are in the Weighbridge. The lead pig weighs 45kg. The balance platform is a supporter in the Weighbridge. "The balance platform is 10m by 8m, giving it an area of [10m multiplied by 8m], currently weighing [the list of things on the platform]. The scale alongside reads: [total weight of things on the platform]. [if two things are on the platform]Average weight is: [the total weight of things on the platform divided by the number of things on the platform]. Heaviest item is [the heaviest thing on the platform], at [weight of the heaviest thing on the platform]. Lightest item is [the lightest thing on the platform], at [weight of the lightest thing on the platform].[otherwise]It seems to be able to weigh several things at once." Test me with "get feather / put it on platform / look / get pig / put it on platform / look".

259
| Example The Speed of Thought Describing scientifically-measured objects in units more familiar to the casual audience. |
WI

257
| Example Depth Receptacles that calculate internal volume and the amount of room available, and cannot be overfilled. |
WI

248
| Example Lead Cuts Paper To give every container a breaking strain, that is, a maximum weight of contents which it can bear - so that to put the lead pig into a paper bag invites disaster. |
WI

231
| Example Swerve left? Swerve right? Or think about it and die? Building a marble chute track in which a dropped marble will automatically roll downhill. |
WI

Previous | Contents | Next