Big refactor of the AI.  Broke much of the core logic into classes to
facilitate testing.