Algorithm For Tic Tac Toe Problem