8.3 Animating the blocks mover

This section uses the blocks action planner from Section 2.19 (modified) and the idiomatic English language command and question interface prototype from Section 7.3. In this section we add an animator (much like in the previous section, 8.2) that incorporates the blocks planner and the natural language command and question interface. If the user runs the program in a terminal window, one will initially see something like the following ...
?> Put a on c and c on b.
                                      
         ---------                    
         |       |                    
         |   a   |                    
         |       |                    
         ---------                    
         ---------                    
         |       |                    
         |   b   |                    
         |       |                    
         ---------                    
         ---------                    
         |       |                    
         |   c   |                    
         |       |                    
         ---------                    
     =================================
                                      
                Fig. 8.3
The user enters commands or questions after the prompt at the upper left of the screen (sample input provided above). For commands to rearrange the blocks, the system parses the input, generates a goal list, attempts to compute a plan to accomplish the goal list, and then plays out the plan for successful computations; otherwise, the system tells the user that the command is not possible. The system is also suppose to answer some questions.

The reader is advised to load the Prolog code for this section, and to try typing in various inputs, using the idioms of Section 7.3.

The graphics animator is quite similar to that in the Section 8.2, and will not be discussed in detail. See the Prolog code for the specifications.

The exercises ask the reader to add various command or question idioms to the animator.

Exercise 8.3.1 Incorporate the question idiom of Exercise 7.3.1.

Exercise 8.3.2 Incorporate the question idiom of Exercise 7.3.2.

Exercise 8.3.3 Incorporate the question idiom of Exercise 7.3.3.

Exercise 8.3.4 Devise a way to add explanations to the blocks mover of this section so that when the user ask for a rearrangement that is invalid, and is told that the task cannot be completed, then if asked "Why?", the system gives an explanation of why the user's request cannot be carried out.


Prolog Code for the blocks mover prototype.  Prolog Code for read_line.
Prolog Tutorial Contents