Artificial Intelligence Fall 2006 Schedule 

Assignment 1: Due 9/7/2006

Part 1: 50 Points

Use the web to find an answer to the following question:

What's the population of Boulder?

What to hand in

Bring a hardcopy report with the answers to these question to class. I'm looking for something on the order of 1 to 2 pages here.

Part 2: 50 Points

This homework requires you to write some code for manipulating representations of mobiles (the things with wires and colorful objects often found floating over babies heads). We'll restrict ourselves to a very restricted set of mobiles with a binary branching structure.

At the top level, mobiles consist of two parts: a left branch and a right branch. Each branch also consists of two parts: a rod that has a length, and an object at the end of the rod. The object at the end of a rod can either be a simple weight or it can be a mobile.

Your task is to write a function called balanced that returns true if the single mobile that is passed to it as an argument is balanced and returns false otherwise. More precisely, when passed a representation of a single mobile it returns a 1 if that mobile is balanced and a 0 otherwise.

A mobile is balanced if and only if the torque on its top-left branch is equal to the torque on its top-right branch AND if the sub-mobiles hanging off of these top branches are themselves balanced. Assume that simple weights at the leaves are always balanced. The torque on a branch is equal to the weight at the end of the branch multiplied by the length of the branch. The weight of the branch is just the weight of the object hanging from it (assume the branch rods are themselves weightless).

Testing

A collection of mobiles, represented simply as lists of lists, can be used for testing. Both balanced and unbalanced mobiles are included in this collection. Use this collection to develop your code. You can use the python "import" statement to load these files for testing.

What to hand in

Bring a hardcopy of your code along with output from the sample runs from the test collection to class on Thursday.

In addition, email me (as a .py attachment named yourlastname-mobiles.py) your working python code.

Shortly after class on the 9th I will post a set of test mobiles. Run your system (unaltered) on these test cases and mail me the results.