The task is to program a strategy for the wumpus world agent. The program must be written in Prolog and will be executed by the Jovolog wumpus world simulator presented in class. The simulator has a built-in version of Prolog interpreter named tuProlog.

The agent should try to fetch the gold while avoiding the dangers (the wumpus and the pits). Grabbing the gold is worth +1000 points, with each action accounting -1 points in the final score, except shooting an arrow which is -5 points. If the game ends by the death of the agent (from the wumpus or a pit), instead of the normal exit, then -1000 points is added. The goal of the agent strategy should be to achieve the best average on the "average" world. The agent may prefer to back off and finish without find the gold, if it is too hard to find it, or it may take an occasional risk. In general it should act opportunistically, which means taking best advantage of the actual situation.

In addition to the general rules of the wumpus world, explained in class, there are the following assumptions. The world created by the Jovolog simulator has an arbitrary but known size (rectangular), which is provided to the agent at step 1. There is exactly one wumpus, one gold, and some number of pits, all at random locations. The agent always starts at position (1,1) facing east, and has one arrow.

Technically, the agent program must successfully prove the act(Action,Knowledge) query, with full unification of both variables to some constant values. The Action variable specifies the single action selected by the agent for her current move. The Knowledge variable equals the list of facts, which the agent wishes to preserve for the next invocation of the program for the next move. The Knowledge variable provides the mechanism by which the agent can build up her knowledge base as she explores the wumpus world.

The wumpus world agent should seek the gold, she may not resort to briefly explore the world and then exit. The grade for the assignment consists of the base grade for an independently written agent program, which should succeed in finding gold at least in the simplest cases. On top of this base grade there will be a bonus for the total point result obtained by the agent. Invalid agent program, ie. one that either is not valid Prolog, or does not respond affirmatively to the act query with the proper unification of arguments, or does not finish in reasonable time, will receive a penalty (beside the points lost due to not completing the round). So it is worthwile to make sure the program works according to the requirements.

The description of the simulator and the wumpus world (in Polish): http://www.kcir.pwr.edu.pl/%7Ewitold/aiuwr/2010_projekty/jovolog/

The download link for the Jovolog simulator: http://www.kcir.pwr.edu.pl/%7Ewitold/ai/jovolog.tar.gz

The simulator package contains the simple agent examples presented in class.

If you have never had any contact with Prolog, then it is advisable to read and work one of the many available Prolog textbooks or on-line tutorials. (Links to some of these are on the course Web page, but feel free to find another one you would like.)

Pay attention to the the recursive mechanisms, such as Prolog invoking itself recursively to prove some fact it needed in the course of proving another fact at an upper level. As well as recursively written rules of a program. It would be useful to independently work the exercises of such a textbook/tutorial, including at least: creating facts and rules, and building and searching lists.

Even though it is not necessary to run a separate Prolog interpreter while working on this assignment, it would be worthwhile to install such a system and practice basic operations: starting the interpreter, loading a program, initiating queries, and simple debugging mechanisms (eg. by printing out messages to stdout). A popular and available Prolog interpreter is SWI Prolog - a community project originally from the University of Amsterdam. Another popular system is Gnu Prolog written by Daniel Diaz.