Hi There!

I'm Dan Schlegel, an Associate Professor in the Computer Science Department at SUNY Oswego

Prolog Challenge 4

The Entrance

Over the past several class sessions we have been developing a blocks world model in which we have experimented with natural language input, reference resolution, state validation, acting, and generating natural language output – a large swath of cognitive processes! In this challenge you will aim to complete our implementation to create an interactive system which can manipulate the world and report the state of the world. To start, grab the version of the blocks world from the shared Google Drive.

Task 1: Reference Resolution

Begin this task by completing the other 1-adjective case and adding the 0-adjective case. Then, consider the following sequence of events, beginning from the initial state of all of the blocks on the table.

  1. Stack the small red block on the small blue block
  2. Stack the large red block on the large green block
  3. *Pickup the red block from the blue block

This last case doesn’t work because our reference resolution is not sophisticated enough to take the stacking context into account.

Improve the reference resolution to allow taking stacking context into account. As you go, thoroughly test the reference resolution code, ensuring that appropriate resolution is always performed. Fix any issues you come across.

Task 2: User Interaction

In this task you will build the main loop for the program and complete some of the details we’ve set aside until now. Begin by writing a rule in the Natural Language Generation (NLG) section of the program which prints out the current state of the world. Feel free to do this however you like, as long as it’s detailed enough that the user can know where all of the blocks are. (It would be fun to somehow illustrate the stacks, don’t you think?)

Once the language generation works, write a main loop for the program. This loop should output the current state of the world and ask for input. The input should then be processed and the cycle should repeat until the user types ‘exit’. The general cycle should be to read input, resolve references, validate the move, and perform the action. You will need to write some new validation rules at this step, since we only started them.

Task 3: Improving User Interaction

Finally, add two niceties to the program, focusing on the natural language processing, natural language generation, and overall usability of the system.

  1. Improve the feedback the program gives when something goes wrong. Minimally it should do the following: if reference resolution fails, the system should tell the user what it can’t resolve. If parsing fails, the system should tell the user that it doesn’t understand the input. There are more opportunities to do nice things, but these two are some minimal expectations.
  2. Allow the user to optionally type a period at the end of a sentence. Do this by modifying the grammar so that there is a second rule for sentence (one which ends in a period). You’ll need to put the period in single-quotes to make Prolog happy.

Task 4 [Extra Credit]: Planning

Consider that we begin with the initial state:

And we’d like to get to the state:

Consider that you would like to do this yourself. What heuristics could you use? Begin by thinking hard about the problem and creating a list of heuristics. Then, implement one or more of your heuristics in Prolog and see how it works! Ideally, your program will output the sequence of steps needed to reach this final state. Be sure to annotate your Prolog code with information about the heuristic chosen and why you chose it!

This extra credit will act to replace the grade of one task on any of the prolog challenge assignments if you missed one. Or, it will improve your score by an equal amount.

The Exit

When done, be sure to submit your files on Brightspace!