Computer Science 315
Artificial Intelligence

Assignment 1 - AIMIA Chapter 2

Round round get around
I get around
Yeah
Get around round round I get around


The Beach Boys, "I Get Around" (1962)

Due Monday, 17 September

Reading Assignment: Artificial Intelligence: A Modern Approach Chapter 2

Programming Assignment: Vacuum World

In this problem set, you will write a Python implementation of the vacuum-cleaner agent described in Exercise 2.7 (page 57) of the textbook. Your "vacuuum cleaner" will actually be a Quagents bot, and the "dust balls" will be packages of tofu (health), but otherwise the task is the same. Lucky for you, all the code for the simulation of the vacuum-cleaner world has been written already. You'll re-use the quagents.py and quagent_client.py code from Assignment 0. All you need to do for the current assignment is download hoover.py and write a little HooverAgent 1 class to take the appropriate actions. This class should be defined in a file called hoover_agent.py. At minimum, HooverAgent should contain a takeAction method. This method should take self and a HooverWorld object as its argument and should return one of the following characters: In other words:
class HooverAgent:
    
    def takeAction(self, world):
        # your code here
    
HooverAgent may contain whatever constructor, private methods and internal state (instance) variables you like; however, the only information it can get from HooverWorld is through the following HooverWorld methods, which take no arguments: Typing python hooover.py in Linux will launch everything and give you a view of your agent in action. (There's no need to look at hoover.py unless you're interested in how it works internally.) Once you turn the vacuum off (by returning 'o' from takeAction), you will be shown your final score. This score differs somewhat from the scoring in the book: in our implementation, you get 100 points for each piece of dirt picked up, you lose one point for each action taken, and you get 500 extra points for ending up at home base. To get started, just have takeAction return 'l' so that your agent always turns left. Note that you do not need a very complicated agent (takeAction method) to solve the problem. My hoover_agent.py was only 36 lines of code, about half of it comments. Because the simulator is nondeterministic (noisy, somewhat random), you may find it useful to add some nondeterminism of your own; e.g., by making a random move every now and then if the agent gets stuck.

You should turn in exactly one file hoover_agent.py, as an email attachment to me. I encourage you to add comments at the top of the file explaining how your solution works. Good luck, and please remember to clean under the sofa.

1"Hoover" is easier to spell than "Vacuum", and sounds funnier too. While you're at it, check out Roomba: these guys are laughing all the way to the bank! For an earlier version of the project, look here.