Nearly working AI, but has bugs that need fixing.