From Puzzles to Programming

Puzzles and Programming

Artificial Intelligence

 

What is artificial intelligence (AI)?

Most authorities on the subject define AI as the study of how to make computers do things which people in general do well or better. In brief, many things humans do or take for granted require lot of programming steps for a computer to do. A simple example would be reading a sentence and understand its meaning:

“Gail went to the bank and took her money out.”

 

For us, this sentence is straight forward, but for a computer “like a learning child” a bank could mean a river bank. More information is then required. In this case, word “money” comes later and then connection of word “bank” to financial terms will give more understanding of the sentence. Thus, in contrast to our common sense, which might actually be a long term human process of knowledge accumulation since childhood, a computer requires several steps, instructions, as well as reference to an encyclopedia of information to process the above sentence in particular or natural language in general.

In this section, we will go through some puzzles and examples to illustrate AI definition further.

 

 

 

 

 

 

 

Example 1:

In the figure below the cubes are arranged in an initial state as follows:

 

 

It is required to place cube A in its expected place below cube B (goal state).

 

In general, we need to arrange any given stack of cubes in an ascending order. It is obviously, a simple doable task for humans, but how to make a computer does this simple task?

One possible program or algorithm is as follows:

For each cube that has the correct support or complete structure of cubes below it, add one point for every block in the support structure. For each cube that has incorrect support structure, subtract one point for every cube in the support structure.

Thus, in the goal state, the score is 0 + 1 + 2 + 3 + 4 + 5 = 15 (0 for A as there are no cubes below it, 1 for B, 2 for C, 3 for D, 4 for E, and 5 for F). The initial state has a score of -15.  Moving cube A from the initial state down to the ground makes the score -10.

 

 

Now, we have 3 possible moves:

a-      Cube A goes back to the stop of the stack making a score of -15,

b-     Cube F goes on top of cube A with a score of -7,

c-      Cube F goes to the ground making a score of -6.

We take the scenario with the highest score, in this case choice c of score -6.

 

 

We continue in this way moving the cubes and take the resultant best scenario until reaching the goal state of score 15, thus arranging the cubes in an ascending order.