Refactored code

AI Play has been re-arranged