CS 221 Completed assignment 6 #1 (credit to https://cs188.googlecode.com/svn/trunk/multiAgents.py)