Fixed the AI as well has a bunch of other minor bugs that were found while trying to fix the AI.  It doesn't play well, but it works.