Due: February 2, 1996
(setq vw (make-vacuum-world)) (print-environment-map vw) (run-eval-environment vw) (run-vacuum) (run-vacuum :display t :max-steps 10) (vacuum-trials)
(defun run-human-agent () (let* ((sag (vacuum-agent 'Me)) (senv (make-vacuum-world :p 0.75 :x-size 4 :y-size 4 :display t :agents (list sag)))) (print-environment-map senv) (run-vacuum :display t :max-steps 20 :agent sag :env senv)))You will be asked to input the actions yourself. You should be able to determine what to enter by studying the code for random-vacuum-agent and reactive-vacuum-agent.
Turn in a copy of the interaction.
``Implement an environment for a n x m rectangular room, where each square has a 5% chance of containing dirt, and n and m are chosen at random from the range of 8 to 15, inclusive.''One convenient way to do this is to define a function that takes a list of agents as an optional argument, and returns an environment as described above containing those agents. Turn in this function definition, and the printing of several instances of the environment showing some random variations.
[Exercise 2.7, p. 52, of the text]
(defstruct (furniture (:include obstacle (name "@"))))Then, we need to write a function for making vacuum worlds with furniture as well as dirt:
(defun make-vacuum-world-with-furniture (&key (p-dirt .25) (p-furniture .25) (x-size 8) (y-size x-size) (display nil) (agents (list (reactive-vacuum-agent 'A)))) "Generate a random vacuum world. P-DIRT is the probability of dirt in a square. P-FURNITURE is the probability of furniture in a square." ;; based on the funcion make-vacuum-world in Aimacode/agents/vacuum.lisp. (init-environment :name "Vacuum World" :agents agents :object-specs `((edge wall) (all (,p-dirt dirt)) (all (,p-furniture furniture))) :x-size x-size :y-size y-size :display display :update-fn #'simple-grid-update-fn :performance-fn #'vacuum-performance-fn :termination-fn #'everyone-dead? :percept-fn #'vacuum-world-percept))
Repeat Exercise 2 above, but make each square in the rooms have a 10% chance of containing dirt and a 5% chance of containing furniture.