[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This week, we’ll add an automatic wumpus walker. It will be pretty stupid. We’ll make it smarter next week.
Work in a new directory (2/b) and start by copying your 2/a code into 2/b.
To do:
(defstruct wme edges nodes pos visited)
Now add a w
var that is initialized at start of game
and carried around all the wumpus code.
Internally, this will be some multi-utility functions that does feature extraction of each edge (sirens? glow? stink?, whatever, use your creativity) and weights these is some way; e.g.
; something like this. note: written, not tested (defun what2DoNext (node) (let* ((edges (edges-from-this-node node)) (scored (mapcar #'edgeScore edges)) (sorted (sort scored #'> :key #'car))) (second (first sorted)))) (defun edgeScore (e) (let ((sirens? (hasSirens e)) (glow? (hasGlow e)) (etc? (otherStuff e))) (cons (edgeScoreFn sires? glow? etc?) e))) (defun edgeScoreFn (sirens? glow? etc?) "a b c are weights on different heuristic search measures" (+ (* a (if sirens? 1 0) (zip)) (* b (if glow? 1 0) (zip)) (* c etc) (zip))) (defun zip () "Returns a random number between 0.99 and 0.999. Enables random selection." (+ 0.99 (randf 0.009)) )
As before, report any changed code.
Also, hand in a REPL session of dumb wumpus playing the game. Include enough trace info so the REPL session reveals what is going on. Include displays of moves, deaths, captures, etc in the REPL text.
Text files (short) describing your edge ranking heuristics.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on March 1, 2011 using texi2html 5.0.