[an error occurred while processing this directive]
FJK Home | CPE/CSC 481 | News | Syllabus | Schedule | Lecture Notes | Assignments | Paper | Project | Teams | Other Links |
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 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... ...
Over the last few years, some other people have developed implementations of the Wumpus World. Most of them use Java, not Jess.
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.
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.
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.
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 |
Franz J. Kurfess |