[an error occurred while processing this directive]
FJK Home CPE/CSC 481 News Syllabus Schedule Lecture Notes Assignments Paper Project Teams Other Links
CPE/CSC 481 Knowledge-Based Systems Winter 2010

CPE/CSC 481-W10 Knowledge-Based Systems Wumpus World in CLIPS/Jess

Topic

Description

Most of you will remember (fondly, I hope ;-) the Wumpus World environment we used in CPE 480 for the explanation of various concepts about Artificial Intelligence and intelligent agents. In this assignment, you will utilize Jess to represent knowledge about the Wumpus World, and to reason about it.

The Wumpus World in Jess

The core system for the Wumpus World is available through the file ww.jess, in combination with some sample files that provide facts for a particular instance of the Wumpus World, such as cave0.jess, cave1.jess, cave2.jess, cave3.jess. The log below shows an example of the WW simulator for the cave0.jess instance. It assumes that you're running Jess from the directory that contains the Wumpus World files.

% jess
Jess, the Java Expert System Shell
Copyright (C) 1998 E.J. Friedman Hill and the Sandia Corporation
Jess Version 6.0b3 11/2/2001
Jess> (batch ww.jess)
TRUE
Jess> (batch cave0.jess)
TRUE
Jess> (reset)
TRUE
Jess> (run)
GENESIS...
Xena enters the caves at (1,1).
Adding adj asserts for a 4 by 4  world.
SIMULATING...
SENSING...
Xena notices (1,2) nearby.
Xena notices (2,1) nearby.
Xena sees no glitter.
Xena feels no breeze in (1,1).
Xena smells nothing.
THINKING...
...

Related Work

Over the last few years, some other people have developed implementations of the Wumpus World. Most of them use Java, not Jess.

Your Tasks

The example system works fine in most of the provided cave instances, but not for cave3.jess. You need to modify the system as described below.

Improve the Hunter's Reasoning Ability

The basic method to use Jess for reasoning is by designing a set of rules that examine certain conditions, and then draw conclusions to perform actions. The current code has these rules to draw conclusions from sensing a stench in a cave.

(defrule evaluate-stench
  (task think)
  (cave (x ?x)(y ?y)(stench TRUE))
  (adj ?x ?y ?x2 ?y2)
  ?f <- (cave (x ?x2)(y ?y2)(has-wumpus UNKNOWN))
  =>
  (printout t "With stench in (" ?x "," ?y "), maybe the wumpus is in (" ?x2  "," ?y2 ")." crlf)
  (modify ?f (has-wumpus MAYBE)))

It marks every adjacent cave to the stench as possibly containing a wumpus (except for caves that we already know are wumpus free or have a wumpus in them). But, we need to make a stronger statement. Not only could one of the caves have a living wumpus, one of them must have it. As we learn more information about the cave, we may be in a situation in which there is only one adjacent cave left that might have a wumpus. If so, then it does have a wumpus. Your task is to add a rule or rules to allow the system to deduce the exact location of the wumpus when possible. Do the same for pits. You might find Jess's query facility useful in this.

New Top Level Goal -- Killing the Wumpus

The hunter in the current system has just one goal -- to explore the caves until she finds and picks up the gold, then leave the caves. Extend the system to add another goal -- eliminating the wumpus. To do this, you can add another slot to the hunter to represent the number of arrows she has:

(deftemplate hunter "A hunter"
  (slot agent (default "Xena"))
  (slot x (type INTEGER))
  (slot y (type INTEGER))
  (slot gold (default 0)(type INTEGER))
  (slot alive (default TRUE))
  (slot arrows (type INTEGER)(number 1))

Add a new action, shoot, which uses up an arrow. If the hunter is in a cave immediately adjacent to a cave with a wumpus, then that wumpus will die a horrible, and deserved, death. Dead wumpi will continue to stink, but they are not dangerous. If the hunter enters a cave with a wumpus corpse, she will not die, although the stench will be hard to get out of her clothes. The goal of the hunter is now to find some gold and kill the wumpus (in either order) and then leave the caves.

Improve the Hunters Ability to Go to a Given Location.

Study the hunters behavior in the world defined by cave3.jess. You will notice that the technique we've used to get the hunter to a distant cave does not work and she is stuck in a cave and can't figure out what to do. Add improved rules to deal with such cases so that the hunter can form a goal to go to a distant cave and will do so, if possible.

Extra Credit: Allow the Wumpus to Move

In this variation, both the hunter and the wumpus can move. If both end up on the same square, the hunter gets eaten. The wumpus also can fall into pits, and can hear the hunter from adjacent squares. It does not perceive any smells. You can give the wumpus different motivations: it could just amble around the environment and snack on a hunter if it happens to encounter one, or it could have an explicit goal to go after the hunter. Please state the motivation your wumpus uses in your documentation. If you decide to tackle this, create another version of the file ww.jess according to the naming conventions below.

Acknowledgement

This assignment is based on a homework assignment in the CMSC471 Artificial Intelligence -- Fall 2001 course at University of Maryland, Baltimore Counties Homework Nine - Jess meets the Wumpus, and a revised version of the assignment from the University of Queensland's course COMP 3701, with minor adaptations by me.


FJK Home CPE/CSC 481 News Syllabus Schedule Lecture Notes Assignments Paper Project Teams Other Links
Wumpus-World.html
last modified:
Wednesday, February, 10, 2010, 14:06:59 PST
© 2000-2024
Franz J. Kurfess