refactoring and ai plays first button