Introduction to Artificial Inteligence

Assignment 2


Programming assignment - games and reasoning

In this assignment, you will write an agent program for the wumpus world (described in chaper 6). This assignment has two parts - in the first you will write an adversarial game , and in the second a reasoning agent.

The wumpus world is a two-dimensional grid (we will use 4 by 4). An agent state consists of the following variables: alive (or dead), location, direction (which way it is facing - E, W, S or N), and whether it has the gold. An agent can execute 6 possible actions: turn left or right 90 degrees, move forward, shoot, grab (the gold), or exit. An agent can only exit successfully if it is standing in an exit square - a square where some agent started its life. Entering a square with a wumpus or a pit causes the agent to die.

As a preliminary, you will need to write up the environment simulator, which generates an initial state, accepts actions, simulates the environment, displays the results and appropriate agent scores. There are three ways to generate a state: by querying a user, randomly, and repeat the previous intial state. Also, write an "agent" that reads actions from the keyboard. Next, you will be implementing the two agents below.

Wumpus world adversarial game

In this version of the game, there are two adversaries, one your intelligent agent, the other is the human user. Each starts at some random location - these locations are considered exits. The agents both know the state of the world, i.e. the location and direction of the agents, location of exit, location of gold. A shoot action works only with probability p = 0.7 (assuming you are facing the wumpus). The game score is for the original wumpus world, i.e. exiting with the gold is worth 1000, and dying is worth minus 10000. Note that you cannot kill the other agent, and shooting here may be useful in that it may allow you to take a shortcut through the square with the wumpus. Write an agent that plays this game using expecti-min-max. Note that there is only one gold, and that the agent that grabs the gold first can force a win.

Wumpus world reasoning agent

In this version, there is only on agent, and the state of the environment is unknown to the agent (it only knows its initial location and direction). However, shooting the wumpus always works when the agent faces the wumpus. Write a program implementing an agent that uses propositional logic to reason about the state of the world. The program should repeatedly derive facts about the occupancy of grid locations, display their known state. This is done by attempting to prove "Wij", "Pij", "Gij" for all i,j. Example display:

+-----+-----+-----+-----+
|  |  |     |     |     |
|  |  |stink|     |     |
|  v  |     |     |     |
+-----+-----+-----+-----+
|     |     |     |     |
| pit |wind |     |     |
|~wump|     |     |     |
+-----+-----+-----+-----+
|     |     |     |     |
|     |     |     |     |
|     |     |     |     |
+-----+-----+-----+-----+
|     |     |     |     |
|     | gold|     |     |
|     |     |     |     |
+-----+-----+-----+-----+

Deliverables

Electronic submission of source code and executables. Frontal grading and checking of the program(s).

Deadline: April 19 (postponed to April 23).