Functional code for swift tic tac toe