As before, let's suppose we have told PopBeast to open the door. Suppose
also that it is working on the first set (square
) of propositions
in Figure 5 - to keep these notes short, I'll ignore
anything it does with the in
, joins
and blocked
ones.
When I tried this out, with PopBeast as shown in Figure 4, it generated the following sequence of actions:
[left, forward, right, forward, left, forward, grab, right, forward, forward, right, forward, forward, left, forward, use ]To check these, you have to know that it was facing East when it started. The notation I have used here is how Prolog displays what's called a list. This is a kind of structure that can hold an arbitrary number of data items. Programming languages that provide lists also allow you to join lists together and insert elements anywhere inside them. Hence lists are very good for storing variable-length data like sentences, musical scores, and action sequences. If you know what arrays are, think about the difference. Arrays are fixed length and cannot be extended.
In the computer, lists themselves are implemented as blocks of bits connected in a certain way. However, you need not worry about that because Prolog takes care of all the details. Finding out how to make programming languages that did this took somewhere between four and ten years, and was a major boost to AI programming. The first major programming language to implement them was called LISP: it is still the most widely used AI language.