TicTacToe JavaScript implementation