The main logic of tic tac toe game