Coffee disambiguation (JACL example)

The key to achieving this type of disambiguation in JACL is being careful with the number of names each object is given. For example, consider the following three objects:

```object ball_1: ball
object ball_2: small red ball
object ball_3: big red ball
```

Presuming all these objects were in the current location, if the player referred to ball, then ball_1 would be selected. This is because the JACL interpreter divides the number of names an object has by the number of names supplied to come up with a best match. Although all three objects have the name ball, ball_1 matches 100% while ball_2 and ball_3 only match 33%. If the player referred to red ball, then ball_1 would automatically be excluded, as it does not have the name red. On the other hand, both ball_2 and ball_3 have the names red ball, and both would match 66%. In this case a message displays stating that the reference was ambiguous. If the player referred to big, then ball_3 would automatically be selected as neither of the other two objects have the name big at all.

The following transcript:

```Coffee disambiguation: v1.0

This pleasant living room is ever-so-lightly furnished with a coffee table. A
kitchen can be found to the north.

>examine coffee
The coffee table is a modern piece of furniture with metal legs and a square
glass top.

>n
This test kitchen is very clean. It's so clean, it hardly has anything in it.
The living room is to the south.

There is a coffee mug here.

Sitting on the bench is a large coffee urn.

>take mug
You take the coffee mug.

>pour coffee
Using the urn, you fill the mug with hot coffee.

>drink coffee
You drink the mug of coffee. Aaah. The satisfaction.

>drink coffee
How rude! Use a mug!

>s
This pleasant living room is ever-so-lightly furnished with a coffee table. A
kitchen can be found to the north.

>examine coffee
Are you referring to:
[1] the coffee mug
[2] the coffee table

Type the number of the object >1

The mug has the phrase 'WORLD'S BEST EXAMPLE CODER' prominently on the outside.
The inside of the mug is empty.
```

Is produced by this code:

```#!../bin/jacl

constant 	GAME_VERSION	1

location kitchen : test kitchen
short		the "test kitchen"
south		living_room

{look
print:
This test kitchen is very clean. It's so clean, it hardly has
anything in it. The living room is to the south.^
.
}

object mug : world's best example coder coffee mug
short		the "coffee mug"
long			"There is a coffee mug here."
mass			4
capacity		5
has			CONTAINER

{examine
print:
The mug has the phrase 'WORLD'S BEST EXAMPLE CODER' prominently on
write "the outside. The inside of the mug is
.
if cup_full(parent) = mug
write "full of coffee.^"
else
write "empty.^"
endif
}

object coffee_urn : big large round heavy coffee urn
short		the "coffee urn"
long			"Sitting on the bench is a large coffee urn."
mass			heavy
capacity		10
has			CONTAINER

{examine
print:
The urn is large, round, and heavy. It has to be large to hold the
endless supply of coffee inside it. Perhaps you'd like to pour some
into a mug?^
.
}

{pour
if mug is *present
if cup_full(parent) = mug
write "But the mug is full!^"
set TIME = false
else
write "Using the urn, you fill the mug with hot coffee.^"
move cup_full to mug
endif
else
write "But you don't have a mug!^"
endif
}

{pour_on_mug
if cup_full(parent) = mug
write "But the mug is full!^"
set TIME = false
else
write "Using the urn, you fill the mug with hot coffee.^"
move cup_full to mug
endif
}

{take_all_from
write "You can't empty the urn.^"
set TIME = false
}

object coffee_supply : endless supply dark of coffee
short		the "endless supply of coffee"
parent		coffee_urn
mass			5
has			LIQUID

{examine
write "Hello, tall, dark, and endless.^"
}

{pour
proxy "pour urn"
}

{pour_on_mug
proxy "pour urn into mug"
}

{smell
write "Hello, tall, dark, and endless.^"
}

{drink
write "How rude! Use a mug!^"
set TIME = false
}

object cup_full : cup full of coffee
short		a "cup full of coffee"
mass			4
has			LIQUID
parent		limbo

{examine
write "The coffee in the mug looks quite drinkable.^"
}

{smell
write "Smells good. A cupful of good.^"
}

{drink : taste
write "You drink the mug of coffee. Aaah. The satisfaction.^"
move cup_full to limbo
}

location living_room : living room
short		the "living room"
north		kitchen

{look
print:
This pleasant living room is ever-so-lightly furnished with a
coffee table. A kitchen can be found to the north.^
.
}

object coffee_table : modern square glass top coffee table
short		the "coffee table"
mass			scenery
has			SURFACE
capacity		20

{examine
print:
The coffee table is a modern piece of furniture with metal legs
and a square glass top.
.
execute +details<noun1
write ^
}

{sit_on : jump_on
write "<p>The spec says you're not allowed to.^"
set TIME = false
}

{+intro
clear
write "^^<p>Coffee disambiguation: v1.0^^"
look
}

object kryten: myself self me
has		ANIMATE
short		name "yourself"
quantity	42
parent		living_room
player

#include "verbs.library"
```