Programming Assignment 4: Wumpus world in Prolog


Table of Contents


Problem Domain

You will be considering the Wumpus world introduced in Russell and Norvig, Chapter 7. For this programming assignment you’ll use Prolog’s ability to do inference in order to write an agent that will make safe moves within its world.


Project Infrastructure

You will need to download and install your own version of SWI-Prolog. It is freely available from http://www.swi-prolog.org/ for major operating systems. Major Linux distributions have copies available within their package system.


Code

The code for this project consists of several Prolog files, some of which you will need to read and understand in order to complete the assignment. You can download all the code and supporting files as a zip archive.

Files you'll edit:
my_agent.pl This is an empty skeleton program. Your assignment is to flesh out the details.
Files you want to look at:
wumpus_world.pl The main file that describes the wumpus world.
utils.pl Useful for implementing the algorithms.

Running the code

Start SWI-Prolog:
pl
Load the world simulator:
?- [wumpus_world].
Load the agent:
?- [my_agent].
Run the agent:
?- wumpus:evaluate_agent(1, Score, Time).

If you read the output, you’ll see the default agent just moves forward. It does this in the world shown in Russell and Norvig’s Figure 7.2, which causes the agent’s dead rather soon. (You use ˆD to exit the programming environment.)

You will need to edit my_agent.pl produce a more rational movement. To do this you will need to define an intelligent run_agent(Percept,Action). The percepts are provided as a list of five elements [Stench, Breeze, Glitter, Bump, Scream], where you receive a “yes” or a “no” in the respective position. There is also an init_agent function which you can use for initialization.

The simulator knows the total state of the world, while your agent will know only what it senses through its perceptions. Initially the agent knows only the perceptions in position (1,1) and in order to acquire other information must be moved in other cells of the grid. Your agent must maintain its own state, containing all the information that gradually becomes available. The state will have to be update with the new perceptions every time an action is executed, and this information must be represented so as to permit reasoning (via interference) as to what operations are safe.


Submission

Submit your assignment via Canvas using these submission instructions

You may discuss this openly with your friends and classmates, but are expected to write your own code and compile your submission independently. If in doubt about whether a resource you used should be included in the list of resources, err on the side of caution and include it.


Academic Integrity: "An Aggie does not lie, cheat, or steal, or tolerate those who do." For additional information please visit: http://student-rules.tamu.edu/aggiecode

Getting Help: You are not alone! If you find yourself stuck on something, contact the TA for help. Office hours are there for your support; please use them. If you can't make our office hours, let us know and we will schedule more. We want these projects to be rewarding and instructional, not frustrating and demoralizing. But, we don't know when or how to help unless you ask.