Refactored the game logic out of the AI