AI languages

Next: List processing and Lisp
Up: No Title
Previous: The development of programming languages
Back: to main list of student notes

# AI languages

With the sort of hardware I've described, it's easy to manipulate numbers. Consequently, computer scientists rapidly worked out how to implement high-level languages whose only concern was numbers, vectors, matrices, etc. It's harder to see how you would implement more ``symbolic'' programs such as a word processor or even a production system.

So in the early days of AI, the programmer had to work out how to encode every item of data - be it a sentence, or a chess-board, or a logical statement - as numbers, and every program as a program that operated on numbers. For example, a hypothetical chess program:

```    integer From, To;
integer array Board [ 1:64 ];

if Board[From] = 1 and
Board[To] /= 0 and
( To=From+7 or To=From+9 )
then
Board[To] := 1;
Board[from] := 0;```
The board is represented as a 1-d array of locations 1 through 64. The piece that's just moved is at location `From`. Each position `P` on the board is associated with a number `Board[P]` representing what's there. It's 0 if the position is empty; 1 for a paawn; 2 for a bishop; etc.

The task of this program fragment is to work out whether the piece being moved is jumping onto an occupied square, and if so whether it can capture anything. The location of the target position is `To`. So the program fragment means ``if the piece being moved (at `From`) is a pawn (`1`), and the target position (`Board[To]`) is not empty (`\= 0`), and it's diagonally ahead of the piece, then move the pawn to the target, and empty the square it was on''. In practice, you'd need to record the capture as well.

Manipulating this kind of encoding is tedious and error-prone. So later languages took over more of the burden:

```    if CurrentMove.Piece = pawn and
IsOccupied( CurrentMove.To ) and
CurrentMove.Direction = diagonal
then
Board[CurrentMove.From] := empty;
Board[CurrentMove.To] := CurrentMove.Piece;```

Next: List processing and Lisp
Up: No Title
Previous: The development of programming languages
Back: to main list of student notes

Jocelyn Ireson-Paine
Wed Feb 14 23:46:11 GMT 1996