Code for tic-tac-toe