% ls
cave0.jess  cave1.jess	cave2.jess  cave3.jess	ww.jess
% jess						; call 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

This copy of Jess will expire in 8 day(s).
Jess> (batch ww.jess)		; batch loads a file of jess facts and rules
TRUE						; ww.jess contains our code for the wumpus world
Jess> (batch cave0.jess)	; cave0.jess has the facts for one world
TRUE
Jess> (reset)				; reset deletes all facts and then 
TRUE						; reasserts any defined via deffacts
Jess> (facts)				; (facts) prints out all current facts
f-0   (MAIN::initial-fact)
f-1   (MAIN::worldsize 4 4)
f-2   (MAIN::wumpus (x 1) (y 3) (alive TRUE))
f-3   (MAIN::pit (x 3) (y 1))
f-4   (MAIN::pit (x 3) (y 3))
f-5   (MAIN::pit (x 4) (y 4))
f-6   (MAIN::gold (x 2) (y 3) (amount 10))
f-7   (MAIN::exit (x 1) (y 1))
f-8   (MAIN::nocave (x 2) (y 4))
f-9   (MAIN::hunter (agent Xena) (x nil) (y nil) (gold 0) (alive TRUE))
For a total of 10 facts.
Jess> (run 10)				; this runs the inference engine for 10 rule executions
GENESIS...					; our rules typically print something informative
Xena enters the caves at (1,1).
Adding adj asserts for a 4 by 4  world.
SIMULATING...
10
Jess> (run 100)				; boy, 10 rules didn't take us very far.  let's go for 100 more.
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...
No stench in (1,1) means no wumpus in (2,1).
There's no breeze in (1,1) so there's no pit  in (2,1).
No stench in (1,1) means no wumpus in (1,2).
There's no breeze in (1,1) so there's no pit  in (1,2).
Xena somewhat wants to go to (1,2).
Xena somewhat wants to go to (2,1).
Seeing no glitter, Xena knows there is no gold in (1,1).
Since Xena is in (1,1) and not dead, it must be safe.
(1,1) is safe, so there's no pit or wumpus in it.
With neither wumpus nor pit, (1,2) is safe.
Xena strongly wants to go to (1,2).
With neither wumpus nor pit, (2,1) is safe.
Xena strongly wants to go to (2,1).
PLANNING...
ACTING...
Xena goes to (2,1).
SIMULATING...
SENSING...
Xena sees no glitter.
Xena feels a breeze in (2,1).
Xena notices (2,2) nearby.
Xena notices (3,1) nearby.
Xena smells nothing.
THINKING...
Xena moderately wants to go to (1,2).
No stench in (2,1) means no wumpus in (2,2).
A breeze in (2,1), so there may be a pit in (2,2).
A breeze in (2,1), so there may be a pit in (3,1).
No stench in (2,1) means no wumpus in (3,1).
Xena somewhat wants to go to (3,1).
Xena somewhat wants to go to (2,2).
Seeing no glitter, Xena knows there is no gold in (2,1).
PLANNING...
ACTING...
Xena goes to (1,1) trying to get to (1,2).
Xena goes to (1,2).
SIMULATING...
SENSING...
Xena sees no glitter.
Xena smells a stench.
Xena notices (1,3) nearby.
Xena feels no breeze in (1,2).
THINKING...
Xena somewhat wants to go to (3,1).
With stench in (1,2), maybe the wumpus is in (1,3).
There's no breeze in (1,2) so there's no pit  in (1,3).
Xena somewhat wants to go to (1,3).
Seeing no glitter, Xena knows there is no gold in (1,2).
There's no breeze in (1,2) so there's no pit  in (2,2).
Xena somewhat wants to go to (2,2).
With neither wumpus nor pit, (2,2) is safe.
Xena strongly wants to go to (2,2).
PLANNING...
ACTING...
Xena goes to (2,2).
SIMULATING...
SENSING...
Xena sees no glitter.
Xena notices (2,3) nearby.
Xena notices (3,2) nearby.
Xena feels no breeze in (2,2).
Xena smells nothing.
THINKING...
Xena somewhat wants to go to (1,3).
Xena somewhat wants to go to (3,1).
There's no breeze in (2,2) so there's no pit  in (2,3).
No stench in (2,2) means no wumpus in (2,3).
Xena somewhat wants to go to (2,3).
No stench in (2,2) means no wumpus in (3,2).
There's no breeze in (2,2) so there's no pit  in (3,2).
Xena somewhat wants to go to (3,2).
Seeing no glitter, Xena knows there is no gold in (2,2).
With neither wumpus nor pit, (3,2) is safe.
Xena strongly wants to go to (3,2).
With neither wumpus nor pit, (2,3) is safe.
Xena strongly wants to go to (2,3).
PLANNING...
100
Jess> (agenda)		; (agenda) shows all the rules which are *ready* to fire.
[Activation: MAIN::choose-desire  f-104, f-103,, ; time=969 ; salience=0]
[Activation: MAIN::choose-desire  f-104, f-102,, ; time=965 ; salience=0]
[Activation: MAIN::plan-to-act  f-104 ; time=243 ; salience=-100]
For a total of 3 activations.
Jess> (run)			; (run) goes until a (halt) is executed or no rules can fire.
ACTING...
Xena goes to (2,3).
SIMULATING...
SENSING...
Xena sees glitter.
Xena feels a breeze in (2,3).
Xena smells a stench.
Xena notices (3,3) nearby.
THINKING...
Xena moderately wants to go to (3,2).
Xena somewhat wants to go to (3,1).
With stench in (2,3), maybe the wumpus is in (3,3).
A breeze in (2,3), so there may be a pit in (3,3).
Xena somewhat wants to go to (3,3).
Seeing glitter, Xena knows there is gold in (2,3).
Xena wants to pick up the gold in (2,3).
Xena somewhat wants to go to (1,3).
PLANNING...
ACTING...
Xena picks up 10 pieces of gold!		; She got it!
SIMULATING...
SENSING...
THINKING...
Xena strongly wants to go to (2,2).
Xena moderately wants to go to (3,2).
Xena somewhat wants to go to (3,1).
Xena somewhat wants to go to (3,3).
Xena somewhat wants to go to (1,3).
PLANNING...
ACTING...
Xena goes to (2,2).
SIMULATING...
SENSING...
THINKING...
Xena somewhat wants to go to (3,3).
Xena strongly wants to go to (1,2).
Xena somewhat wants to go to (1,3).
Xena somewhat wants to go to (3,1).
Xena strongly wants to go to (3,2).
PLANNING...
ACTING...
Xena goes to (1,2).
SIMULATING...
SENSING...
THINKING...
Xena somewhat wants to go to (3,3).
Xena moderately wants to go to (3,2).
Xena strongly wants to go to (1,1).
Xena somewhat wants to go to (3,1).
Xena somewhat wants to go to (1,3).
PLANNING...
ACTING...
Xena goes to (1,1).
Xena leaves the caves.			; and ten gold pieces richer, too.
70
Jess>