# Clarity and Ambiguity

## Communication Is Key

Algorithms are just lists of instructions for solving a given problem. But in order for the instructions to work, they must be followed exactly as intended. Fortunately, computers are very good at doing what they’re told. In fact, they’re designed to execute a sequence of operations in a completely predictable manner. They do exactly what they’re told.

When computers misbehave, it’s not the fault of the computer, but the fault of the program. More specifically, it’s the fault of the programmer—the human who designed the algorithm in the first place. If the computer does something the programmer didn’t intend, it’s because it was given the wrong set of instructions. In order to get a computer to do what’s intended, you must specify what you mean very precisely.

## Exercise

She saw the man on the hill with the telescope.

Sketch a picture of the scene described by the above statement. Then, compare your drawing to those of your neighbors. Are they the same? Are they different? Why?

Discuss your observations with the class.

## Avoiding Ambiguity

If you ask someone for directions and they say, “Third door on the left,” do they mean their left or your left? Without clarifying “my” or “your” left, the statement is ambiguous; its exact meaning can be interpreted in different ways.

In the previous exercise, you and your neighbors likely did not all draw the same thing. And yet, all of your drawings were probably perfectly correct interpretations of the phrase, “She saw the man on the hill with the telescope.

So why the difference in the drawings? Because the statement is ambiguous! Computer scientists would say that the sentence has multiple parse trees. That means that there are multiple ways in which the sentence can be interpreted, or parsed.

If we look more closely at the sentence, the heart of the problem stems from the prepositional phrases, “on the hill” and “with the telescope.” Which of these nouns does “with the telescope” refer to? The woman? The man? Or the hill? Without additional information, it could modify any of them.

In fact, there are six different interpretations of the sentence that are all equally valid from a grammatical standpoint.

Which one of these did you draw? Can you draw the six different interpretations?