Fixed the AI so it really doesn't make invalid moves